﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0046)http://www.codeproject.com/KB/game/sudoku.aspx -->
<HTML><HEAD><TITLE>CodeProject: Sudoku Solver and Generator. Free source code and programming help</TITLE><LINK 
href="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/ForumClassicIE6.css" 
type=text/css rel=stylesheet><LINK 
href="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/CodeProject.css" 
type=text/css rel=stylesheet><LINK 
href="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/ForumClassic.css" 
type=text/css rel=stylesheet>
<STYLE type=text/css>.FeatureBlockContent {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px
}
.FeatureBlockContent UL {
	PADDING-LEFT: 20px
}
</STYLE>
<LINK 
href="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/navmenu_ie6.css" 
type=text/css rel=stylesheet>
<STYLE type=text/css>#ATD {
	BORDER-RIGHT: #999 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: #999 1px solid; DISPLAY: none; PADDING-LEFT: 10px; Z-INDEX: 200; LEFT: -5000px; PADDING-BOTTOM: 10px; BORDER-LEFT: #999 1px solid; PADDING-TOP: 10px; BORDER-BOTTOM: #999 1px solid; WHITE-SPACE: nowrap; POSITION: absolute; TOP: -90px; BACKGROUND-COLOR: white
}
</STYLE>

<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META 
content="Solves and generates Sudokus.; Author: Jrgen Pramberg; Section: Game Development; Chapter: Platforms, Frameworks &amp; Libraries" 
name=Description>
<META 
content="VC7.1, .NET 1.1, VS.NET2003, C#, Windows, Dev, Intermediate,Game Development,Platforms, Frameworks &amp; Libraries,Free source code, tutorials" 
name=Keywords>
<META content="The Code Project" name=Author>
<META content=General name=Rating>
<META content="index, follow" name=Robots>
<META content="1 days" name=Revisit-After><LINK 
title="CodeProject Latest articles - All topics" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=1" 
type=application/rss+xml rel=alternate><LINK 
title="CodeProject Latest articles - MFC / C++" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=2" 
type=application/rss+xml rel=alternate><LINK 
title="CodeProject Latest articles - C#" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=3" 
type=application/rss+xml rel=alternate><LINK 
title="CodeProject Latest articles - ASP.NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=4" 
type=application/rss+xml rel=alternate><LINK 
title="CodeProject Latest articles - .NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=5" 
type=application/rss+xml rel=alternate><LINK 
title="CodeProject Latest articles - VB.NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=6" 
type=application/rss+xml rel=alternate><LINK title="CodeProject Lounge Postings" 
href="http://www.codeproject.com/webservices/LoungeRSS.aspx" 
type=application/rss+xml rel=alternate><LINK title=CodeProject 
href="http://www.codeproject.com/info/OpenSearch.xml" 
type=application/opensearchdescription+xml rel=search><LINK href="/favicon.ico" 
type=image/ico rel=icon><LINK href="/favicon.ico" type=image/ico 
rel="shortcut icon">
<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/jquery-1.3.2.min.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/ShortCuts.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript type=text/javascript>//<![CDATA[
if(top!=self)top.location.href=location.href; if(typeof(DemoUrl)!="undefined")document.write(unescape('%3Cme')+'ta http'+'-equiv="re' +'fresh" con'+'tent="1;url='+DemoUrl+unescape('"%3CE'));
function LK(e) { var lounge  = document.getElementById("ctl00_TopNavBar_Lounge"); var soapbox = document.getElementById("ctl00_TopNavBar_Soapbox"); if (lounge && soapbox) {   lounge.style.display = e.ctrlKey? "none" : "inline";  soapbox.style.display = e.ctrlKey? "inline" : "none"; }}
function LC(e) {
 window.location.href = e.ctrlKey ? '/script/Forums/View.aspx?fid=1536756':'/Lounge.aspx';
 if (document.all) e.returnValue = false; else e.preventDefault();
}
function ToggleMenu(itemName)
{
	var elm = document.getElementById(itemName);
	var i,others = document.getElementById('SectionMenu');
	for(i=0; i < others.childNodes.length; i++)
	{
		var other = others.childNodes[i];
		if ((other.className == 'MenuSectionBlock') && (other != elm))
			other.style.display='none';
	}
	if (elm.style.display == 'block') elm.style.display='none';
	else elm.style.display='block';
	return false;
}

function ChkRtctl00_RateArticle(val, objId) {if (val<=2) {$('div[name=RateItem_' + objId + '] .RateComDiv').css("display","");}else $('div[name=RateItem_' + objId + '] .RateComDiv').css("display","none");}
function MarkAns(MemberID,MsgID,gp,bp,mt,QID){
 document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\"  onclick=\"RateMsg("+MemberID.toString()+","+MsgID.toString()+",6,"+QID.toString()+");\"%3E"));
 document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/good.png\" alt=\"good\" border=\"0\" align=\"absmiddle\" /%3E "+gp+" "+mt+"%3C/a%3E "));
 document.write(" &nbsp;"); document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\"  onclick=\"RateMsg("+MemberID.toString()+","+MsgID.toString()+",7,"+QID.toString()+");\"%3E"));
 document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/bad.png\" alt=\"bad\" border=\"0\" align=\"absmiddle\" /%3E "+bp+" "+mt+"%3C/a%3E"));
}

function MsgVFrm(MemberID,MsgID,GB,gp,bp,mt){
 if(!GB)document.write("Rate this message: ");
 document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"5":"1")+unescape(",0);\"%3E"));
 if(GB) document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/good.png\" alt=\"good\" border=\"0\" align=\"absmiddle\" /%3E "+gp+" "+mt+"%3C/a%3E "));
 else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_down.gif\" alt=\"vote 1\" border=\"0\" align=\"middle\" /%3E%3C/a%3E "));
 if(GB)document.write(" &nbsp;"); else for(var i=1; i<=5;i++)
  document.write(unescape("%3Ca class=\"Frm_MHL\" href=\"#xx" + MsgID.toString() + "xx\" title=\"vote this message a " + i.toString() + "\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ", " + i.toString() + ",0)\"%3E%3Cb%3E" + i.toString() + "%3C/b%3E%3C/a%3E "));
 document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"1":"5")+unescape(",0);\"%3E"));
 if(GB)document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/bad.png\" alt=\"bad\" border=\"0\" align=\"absmiddle\" /%3E "+bp+" "+mt+"%3C/a%3E"));
 else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_up.gif\" border=\"0\" alt=\"vote 5\" align=\"middle\" /%3E%3C/a%3E "));
}

function ReportMsg(userid, msgid, score) {
 if (confirm("Are you sure you want this message removed?"))
  return RateMsg(userid, msgid, score, 0);
 else return false;
}
function RateMsg(memberid, msgid, score, questionId) {
 var req = new ActiveXObject("MSXML2.XMLHTTP");
 req.onreadystatechange = function() {
  if (req.readyState == 4){
   if (req.status == 200){
    var respText = req.responseText;
    var re = new RegExp(unescape("\%3Cdiv\%3E([^\%3C]*)\%3C/div\%3E"), "g");
    var match = re.exec(respText);
    voteStatus.innerHTML = unescape("%3Cb%3E") + (match&&match[1])?match[1]:"An error occured" + unescape("%3C/b%3E");
   } else
    voteStatus.innerHTML = unescape("%3Cb style='color:red'%3EFailed!") + req.statusText + unescape("%3C/b%3E");
  }
 }
 var voteStatus = document.getElementById("MVF" + msgid);
 if (!voteStatus) return;
 voteStatus.innerHTML = unescape("%3Cb style='color:green'%3EVoting...%3C/b%3E");
 var strAction = "/script/Forums/Vote.aspx?js=1&fmid="+memberid.toString()+"&select="+msgid.toString()+"&score="+score.toString()+"&qid="+questionId.toString();
 req.open("GET", strAction, true);
 req.send(null);
  return false;
}
var Selected = "-1";
function Pin(elm){
 CloseMsg(Selected);
 var wrk=elm.parentNode; if(wrk)wrk=wrk.firstChild;
 var fc=elm?elm.firstChild:null;
 if (wrk&&!wrk.pinned) {
  OpenMsg(wrk.name, true);wrk.pinned=true;fc.src='/script/forums/images/pinned.gif';fc.title='Pinned. Click to unpin'
 } else {
  wrk.pinned=false;CloseMsg(wrk.name); fc.src='/script/forums/images/pin.gif';fc.title='Click to pin message'
 }
 return false;
}
function CloseMsg(msgId) {
 if(!msgId||(msgId==''))return;
 var lnk=document.getElementsByName(msgId);
 if(lnk&&lnk.length>0&&lnk[0].pinned)return;
 var head=eval("document.getElementById('F" + msgId + "_h0')");
 if(head) head.className = head.className.replace("Sel", "UnSel");
 var body=eval("document.getElementById('F" + msgId + "_h1')");
 if(body) body.style.display = 'none';
}
function OpenMsg(msgId, keep) {
 if(!msgId||(msgId==''))return;
 var body=eval("document.getElementById('F" + msgId + "_h1')");
 if(body){
  var lnk=document.getElementsByName(msgId);
  if(lnk&&lnk.length>0&&lnk[0].pinned)keep=true;
  if(keep&&body.style.display!='none')return;
  if(body.style.display=='none') body.style.display='';
  else body.style.display = 'none';
 }
 var head=eval("document.getElementById('F" + msgId + "_h0')");
 if (head) head.className = head.className.replace('UnSel', 'Sel');
 if(body&&head&&body.style.display!='none'){
  document.body.scrollTop = getRealPos(head, 'Top') - document.body.clientHeight/10;
  EnsureMessageVisible(msgId, true);
 }
}

function SwitchMessage(e, msgId)
{
  if (msgId) msgId=msgId.toString();
  else {
    if(!e)e=window.event;
    var target=e.target?e.target:e.srcElement;
    while(target&&target.id!='DynMessLink')target=target.parentNode;
    if(!target||target.id!='DynMessLink')return;
    if(target.pinned){Selected='';return false;}
    msgId=target.name;
  }
  CloseMsg(Selected)
  if(Selected==msgId) Selected='';
  else { OpenMsg(msgId, false); Selected=msgId;}
  if (e){if(e.preventDefault)e.preventDefault;else e.returnValue=false;}
  return false;
}


//]]></SCRIPT>

<SCRIPT type=text/javascript>
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</SCRIPT>

<SCRIPT type=text/javascript>
if (typeof(_gat) != "undefined" && _gat)
{ 
	var pageTracker = _gat._getTracker("UA-1735123-1");
	pageTracker._setDomainName("www.codeproject.com");
	pageTracker._setSessionTimeout("1200"); // 20 mins
	pageTracker._initData();
	pageTracker._trackPageview();
}
</SCRIPT>

<META content="MSHTML 6.00.2900.5880" name=GENERATOR></HEAD>
<BODY><A href="http://www.codeproject.com/KB/game/sudoku.aspx#Main"><IMG 
style="Z-INDEX: 100; LEFT: 0px; WIDTH: 1px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 0px; HEIGHT: 1px; BORDER-BOTTOM-STYLE: none" 
alt="Click here to Skip to main content" 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/t.gif"></A> 

<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 100%; PADDING-TOP: 0px">
<DIV style="WIDTH: 100%">
<TABLE class=MemberNavBar cellSpacing=0 cellPadding=5 width="100%">
  <TBODY>
  <TR>
    <TD style="FONT-WEIGHT: bold">6,612,941 members and growing! (17,567 
      online)</TD>
    <TD align=right>
      <DIV class=MemberNavBarText id=ctl00_MemberMenu_LoggedOnOptions><A 
      id=ctl00_MemberMenu_MyProfile 
      href="http://www.codeproject.com/script/Membership/View.aspx?mid=6600320">675895105</A> 
      | <A id=ctl00_MemberMenu_MySettings 
      href="http://www.codeproject.com/script/Membership/Modify.aspx">Settings</A> 
      | <A id=ctl00_MemberMenu_MyCodeProject 
      href="http://www.codeproject.com/script/Membership/MyCodeProject.aspx"><B>Watched 
      Items</B></A> | <A id=ctl00_MemberMenu_MyBookmarks 
      href="http://www.codeproject.com/script/Bookmarks/List.aspx?obtid=2">Bookmarks</A> 
      | <A id=ctl00_MemberMenu_MyArticles 
      href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=6600320">My 
      Articles</A> | <A id=ctl00_MemberMenu_Signout 
      href="http://www.codeproject.com/script/Membership/LogOff.aspx?rp=%2fKB%2fgame%2fsudoku.aspx">Sign 
      out</A> </DIV></TD></TR></TBODY></TABLE></DIV>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD class=HeaderLogo><A href="http://www.codeproject.com/"><IMG 
      id=ctl00_Logo 
      style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 225px; HEIGHT: 90px; BORDER-RIGHT-WIDTH: 0px" 
      alt="The Code Project" 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/logo225x90.gif"></A></TD>
    <TD class=HeaderBanner align=right width="100%">
      <SCRIPT type=text/javascript>document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d12104%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20src%3d%22%2fscript%2fAdServe%2fServeImg.aspx%3fFile%3dComponentone_sharepoint_0909_728x90_25k_30102009051512.gif%26C%3dFalse%26adid%3d12104%26obid%3d11983%26obtid%3d2%22%20alt%3d%22%22%20border%3d%220%22%20width%3d%22728px%22%20height%3d%2290px%22%3e%3c%2fa%3e"));</SCRIPT>
    </TD></TR></TBODY></TABLE>
<DIV class=NavBarMain>
<UL id=nav>
  <LI><A href="http://www.codeproject.com/">Home</A> </LI>
  <LI><A class=down id=ctl00_TopNavBar_Art 
  href="http://www.codeproject.com/script/Articles/Latest.aspx">Articles</A> 
  <UL class=flyout>
    <LI><A class="fly break" id=ctl00_TopNavBar_ArtSearch 
    href="http://www.codeproject.com/info/search.aspx">Search</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtLatest 
    href="http://www.codeproject.com/script/Articles/Latest.aspx">Latest 
    Articles</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtTop 
    href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=4">Top 
    Articles</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtBeginner 
    href="http://www.codeproject.com/info/search.aspx?vidlst=152&amp;sa_us=True">Beginner 
    Articles</A> </LI>
    <LI><A class="fly break" id=ctl00_TopNavBar_ArtBlogArticles 
    href="http://www.codeproject.com/script/Articles/BlogArticleList.aspx">Technical 
    Blogs</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtPostArticle 
    href="http://www.codeproject.com/info/Submit.aspx">Post an Article</A> </LI>
    <LI></LI>
    <LI><A class="fly break" id=ctl00_TopNavBar_ArtPostBlog 
    href="http://www.codeproject.com/script/Articles/BlogFeed.aspx">Post your 
    Blog</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtGuide 
    href="http://www.codeproject.com/info/Submit.aspx">Posting/Update 
    Guidelines</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_ArtCompetition 
    href="http://www.codeproject.com/script/Awards/CurrentCompetitions.aspx?cmpTpId=1">Article 
    Competition</A> </LI>
    <LI><A class=last id=ctl00_TopNavBar_ArtTopicList 
    href="http://www.codeproject.com/script/Content/SiteMap.aspx">Topic List</A> 
    </LI></UL></LI>
  <LI><A class=down id=ctl00_TopNavBar_MessageBoards 
  href="http://www.codeproject.com/script/Forums/List.aspx">Message Boards</A> 
  <UL class=flyout>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/12076/ASP-NET.aspx">ASP.NET</A> 
</LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/4486/ATL-WTL-STL.aspx">ATL / WTL / 
    STL</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1647/C-Cplusplus-MFC.aspx">C / C++ / 
    MFC</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/3785/Managed-Cplusplus-CLI.aspx">Managed 
    C++/CLI</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1649/Csharp.aspx">C#</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1648/COM.aspx">COM</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/186301/Hardware-Devices.aspx">Hardware 
    &amp; Devices</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1004117/LINQ.aspx">LINQ</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1650/NET-Framework.aspx">.NET 
    Framework</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1644/System-Admin.aspx">System 
    Admin</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1004257/Silverlight.aspx">Silverlight</A> 
    </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1725/General-Database.aspx">General 
    Database</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1540733/Sharepoint.aspx">Sharepoint</A> 
    </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1646/Visual-Basic.aspx">Visual 
    Basic</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1640/Web-Development.aspx">Web 
    Development</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1004114/WPF-WCF-WF.aspx">WPF / WCF / 
    WF</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/3421/XML-XSL.aspx">XML / XSL</A> 
    </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1642/General-IT-Issues.aspx">General 
    IT Issues</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1645/Site-Bugs-Suggestions.aspx">Site 
    Bugs / Suggestions</A> </LI>
    <LI><A class=fly 
    href="http://www.codeproject.com/Forums/1536756/The-Soapbox-2-0.aspx">The 
    Soapbox 2.0</A> </LI>
    <LI><A class=last id=ctl00_TopNavBar_MessageBoardsAll 
    href="http://www.codeproject.com/script/Forums/List.aspx">All Message 
    Boards...</A> </LI></UL></LI>
  <LI><A id=ctl00_TopNavBar_Job 
  href="http://www.codeproject.com/script/Jobs/List.aspx">Job Board</A> 
  <UL class=flyout>
    <LI><A class=fly id=ctl00_TopNavBar_JobLatest 
    href="http://www.codeproject.com/script/Jobs/List.aspx">Latest</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_JobSearch 
    href="http://www.codeproject.com/script/Jobs/Search.aspx">Search</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_JobPost 
    href="http://www.codeproject.com/script/Jobs/Edit.aspx">Post a Job</A> </LI>
    <LI><A class=last id=ctl00_TopNavBar_JobFaq 
    href="http://www.codeproject.com/script/Jobs/FAQ.aspx">FAQ and Pricing</A> 
    </LI></UL></LI>
  <LI><A id=ctl00_TopNavBar_Cat 
  href="http://www.codeproject.com/script/Catalog/List.aspx">Catalog</A> 
  <UL class=flyout>
    <LI><A class=fly id=ctl00_TopNavBar_CatLatest 
    href="http://www.codeproject.com/script/Catalog/List.aspx?ctls=DatePostedDescending">Latest</A> 
    </LI>
    <LI><A class=fly id=ctl00_TopNavBar_CatSearch 
    href="http://www.codeproject.com/script/Catalog/List.aspx">Search</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_CatPost 
    href="http://www.codeproject.com/script/Catalog/Edit.aspx">Post a Catalog 
    Item</A> </LI>
    <LI><A class=last id=ctl00_TopNavBar_CatFaq 
    href="http://www.codeproject.com/script/Catalog/FAQ.aspx">FAQ and 
    Pricing</A> </LI></UL></LI>
  <LI><A id=ctl00_TopNavBar_Help 
  href="http://www.codeproject.com/info/FAQ.aspx">Help!</A> 
  <UL class=flyout>
    <LI><A class=fly id=ctl00_TopNavBar_HelpWhatIs 
    href="http://www.codeproject.com/info/guide.aspx">What is 'The Code 
    Project'?</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_HelpGeneral 
    href="http://www.codeproject.com/info/FAQ.aspx">General FAQ</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_HelpPostQuestion 
    href="http://www.codeproject.com/script/Forums/List.aspx">Post a 
    Question</A> </LI>
    <LI><A class=fly id=ctl00_TopNavBar_HelpSiteMap 
    href="http://www.codeproject.com/script/Content/SiteMap.aspx">Site 
    Directory</A> </LI>
    <LI><A class=last id=ctl00_TopNavBar_HelpAboutUs 
    href="http://www.codeproject.com/info/about.aspx">About Us</A> </LI></UL></LI>
  <LI style="FLOAT: right"><A id=ctl00_TopNavBar_Lounge 
  href="javascript:void();">Lounge</A> <A id=ctl00_TopNavBar_Soapbox 
  style="DISPLAY: none" href="javascript:void();">Soapbox</A> </LI></UL></DIV>
<DIV style="WIDTH: 100%"><A name=_top></A>
<TABLE class=ArticleHeader id=ctl00_ArticleTopHeader_HeaderTable cellPadding=3 
width="100%">
  <TBODY>
  <TR vAlign=top>
    <TD class=SmallText><A id=ctl00_ArticleTopHeader_ChapterLink 
      href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=8">Platforms, 
      Frameworks &amp; Libraries</A> » <A id=ctl00_ArticleTopHeader_SectionLink 
      href="http://www.codeproject.com/KB/game/">Game Development</A> » <A 
      id=ctl00_ArticleTopHeader_SubsectionLink 
      href="http://www.codeproject.com/KB/game/index.aspx?#Game Development - Games">Games</A> 
      <SPAN class=ArticleIntermediate 
      id=ctl00_ArticleTopHeader_SkillLevel>&nbsp;&nbsp;&nbsp; 
      Intermediate</SPAN> <SPAN 
      id=ctl00_ArticleTopHeader_LicenceTerms></SPAN><BR><BR>
      <H1><SPAN class=ArticleTopTitle 
      id=ctl00_ArticleTopHeader_ArticleTitle>Sudoku Solver and 
      Generator</SPAN></H1><B>By <A 
      href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=634442">Jrgen 
      Pramberg</A></B><BR><BR><SPAN 
      id=ctl00_ArticleTopHeader_ArticleDescr>Solves and generates 
      Sudokus.</SPAN> </TD>
    <TD style="WIDTH: 210px"><SPAN class=SmallText 
      id=ctl00_ArticleTopHeader_ArticleAttributes>C#, VC7.1, Windows, .NET 
      1.1VS.NET2003, Dev</SPAN> 
      <TABLE class=SmallText 
      style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 8px 0px 0px; PADDING-TOP: 0px">
        <TBODY>
        <TR>
          <TD>Posted:</TD>
          <TD><B>18 Oct 2005</B></TD></TR>
        <TR>
          <TD>Updated:</TD>
          <TD><B>8 Nov 2005</B></TD></TR>
        <TR>
          <TD>Views:</TD>
          <TD><B>146,456</B></TD></TR>
        <TR>
          <TD>Bookmarked:</TD>
          <TD><B>85 
times</B></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></DIV>
<DIV>
<DIV class=LHNavBar id=ctl00_LHNavBar>
<DIV class=announce-header>Announcements</DIV>
<DIV class=announce-content>
<TABLE cellPadding=2>
  <TBODY>
  <TR vAlign=center>
    <TD><IMG height=24 alt=Comp 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/app_24.jpg" 
      width=24 align=middle></TD>
    <TD><A 
      href="http://www.codeproject.com/Competitions/370/Windows-7-Contest.aspx">Windows 
      7 Comp<BR>Win a laptop!</A></TD></TR>
  <TR vAlign=center>
    <TD><IMG height=24 alt=Comp 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/MonthlyComp.png" 
      width=24 align=middle></TD>
    <TD><A id=ctl00_Announcements_CompLink 
      href="http://www.codeproject.com/Feature/ArticleCompetition/">Monthly 
      Competition</A></TD></TR></TBODY></TABLE></DIV>
<DIV id=Th><IMG id=Li height=16 alt=Loading... 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/ajax-arrows-green.gif" 
width=16> </DIV>
<DIV id=SectionMenu>
<DIV class=MenuCat>Articles</DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter1');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=1">Desktop 
Development</A></DIV>
<DIV class=MenuSectionBlock id=Chapter1 style="DISPLAY: none">
<DIV class=MI id=Section1><A 
href="http://www.codeproject.com/KB/buttons/">Button Controls</A></DIV>
<DIV class=MI id=Section15><A 
href="http://www.codeproject.com/KB/clipboard/">Clipboard</A></DIV>
<DIV class=MI id=Section2><A 
href="http://www.codeproject.com/KB/combobox/">Combo &amp; List Boxes</A></DIV>
<DIV class=MI id=Section67><A 
href="http://www.codeproject.com/KB/dialog/">Dialogs and Windows</A></DIV>
<DIV class=MI id=Section107><A 
href="http://www.codeproject.com/KB/gadgets/">Desktop Gadgets</A></DIV>
<DIV class=MI id=Section16><A 
href="http://www.codeproject.com/KB/docview/">Document / View</A></DIV>
<DIV class=MI id=Section4><A href="http://www.codeproject.com/KB/edit/">Edit 
Controls</A></DIV>
<DIV class=MI id=Section17><A href="http://www.codeproject.com/KB/files/">Files 
and Folders</A></DIV>
<DIV class=MI id=Section3><A href="http://www.codeproject.com/KB/grid/">Grid 
&amp; Data Controls</A></DIV>
<DIV class=MI id=Section5><A href="http://www.codeproject.com/KB/list/">List 
Controls</A></DIV>
<DIV class=MI id=Section6><A 
href="http://www.codeproject.com/KB/menus/">Menus</A></DIV>
<DIV class=MI id=Section14><A 
href="http://www.codeproject.com/KB/miscctrl/">Miscellaneous</A></DIV>
<DIV class=MI id=Section18><A 
href="http://www.codeproject.com/KB/printing/">Printing</A></DIV>
<DIV class=MI id=Section95><A 
href="http://www.codeproject.com/KB/progress/">Progress Controls</A></DIV>
<DIV class=MI id=Section11><A 
href="http://www.codeproject.com/KB/selection/">Selection Controls</A></DIV>
<DIV class=MI id=Section19><A href="http://www.codeproject.com/KB/shell/">Shell 
and IE programming</A></DIV>
<DIV class=MI id=Section68><A href="http://www.codeproject.com/KB/smart/">Smart 
Client</A></DIV>
<DIV class=MI id=Section8><A 
href="http://www.codeproject.com/KB/splitter/">Splitter Windows</A></DIV>
<DIV class=MI id=Section9><A href="http://www.codeproject.com/KB/static/">Static 
&amp; Panel Controls</A></DIV>
<DIV class=MI id=Section10><A 
href="http://www.codeproject.com/KB/statusbar/">Status Bar</A></DIV>
<DIV class=MI id=Section7><A href="http://www.codeproject.com/KB/tabs/">Tabs 
&amp; Property Pages</A></DIV>
<DIV class=MI id=Section12><A 
href="http://www.codeproject.com/KB/toolbars/">Toolbars &amp; Docking 
windows</A></DIV>
<DIV class=MI id=Section13><A href="http://www.codeproject.com/KB/tree/">Tree 
Controls</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter2');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=2">Web 
Development</A></DIV>
<DIV class=MenuSectionBlock id=Chapter2 style="DISPLAY: none">
<DIV class=MI id=Section70><A href="http://www.codeproject.com/KB/ajax/">Ajax 
and Atlas</A></DIV>
<DIV class=MI id=Section27><A 
href="http://www.codeproject.com/KB/applications/">Applications &amp; 
Tools</A></DIV>
<DIV class=MI id=Section85><A 
href="http://www.codeproject.com/KB/asp/">ASP</A></DIV>
<DIV class=MI id=Section89><A 
href="http://www.codeproject.com/KB/aspnet/">ASP.NET</A></DIV>
<DIV class=MI id=Section28><A 
href="http://www.codeproject.com/KB/webforms/">ASP.NET Controls</A></DIV>
<DIV class=MI id=Section38><A 
href="http://www.codeproject.com/KB/ATL-Server/">ATL Server</A></DIV>
<DIV class=MI id=Section29><A 
href="http://www.codeproject.com/KB/web-cache/">Caching</A></DIV>
<DIV class=MI id=Section91><A 
href="http://www.codeproject.com/KB/web-image/">Charts, Graphs and 
Images</A></DIV>
<DIV class=MI id=Section25><A 
href="http://www.codeproject.com/KB/scripting/">Client side scripting</A></DIV>
<DIV class=MI id=Section30><A 
href="http://www.codeproject.com/KB/custom-controls/">Custom Controls</A></DIV>
<DIV class=MI id=Section23><A href="http://www.codeproject.com/KB/HTML/">HTML / 
CSS</A></DIV>
<DIV class=MI id=Section24><A 
href="http://www.codeproject.com/KB/ISAPI/">ISAPI</A></DIV>
<DIV class=MI id=Section33><A 
href="http://www.codeproject.com/KB/server-management/">Site &amp; Server 
Management</A></DIV>
<DIV class=MI id=Section34><A 
href="http://www.codeproject.com/KB/session/">Session State</A></DIV>
<DIV class=MI id=Section113><A 
href="http://www.codeproject.com/KB/silverlight/">Silverlight</A></DIV>
<DIV class=MI id=Section36><A href="http://www.codeproject.com/KB/trace/">Trace 
and Logs</A></DIV>
<DIV class=MI id=Section31><A 
href="http://www.codeproject.com/KB/user-controls/">User Controls</A></DIV>
<DIV class=MI id=Section37><A 
href="http://www.codeproject.com/KB/validation/">Validation</A></DIV>
<DIV class=MI id=Section35><A 
href="http://www.codeproject.com/KB/viewstate/">View State</A></DIV>
<DIV class=MI id=Section26><A href="http://www.codeproject.com/KB/WAP/">WAP / 
WML</A></DIV>
<DIV class=MI id=Section32><A 
href="http://www.codeproject.com/KB/web-security/">Web Security</A></DIV>
<DIV class=MI id=Section20><A 
href="http://www.codeproject.com/KB/webservices/">Web Services</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter9');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=9">Enterprise 
Systems</A></DIV>
<DIV class=MenuSectionBlock id=Chapter9 style="DISPLAY: none">
<DIV class=MI id=Section98><A href="http://www.codeproject.com/KB/MCMS/">Content 
Management Server</A></DIV>
<DIV class=MI id=Section99><A 
href="http://www.codeproject.com/KB/biztalk/">Microsoft BizTalk Server</A></DIV>
<DIV class=MI id=Section102><A 
href="http://www.codeproject.com/KB/exchange/">Microsoft Exchange</A></DIV>
<DIV class=MI id=Section90><A 
href="http://www.codeproject.com/KB/office/">Office Development</A></DIV>
<DIV class=MI id=Section101><A 
href="http://www.codeproject.com/KB/sharepoint/">SharePoint 
Server</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter3');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=3">Multimedia</A></DIV>
<DIV class=MenuSectionBlock id=Chapter3 style="DISPLAY: none">
<DIV class=MI id=Section42><A 
href="http://www.codeproject.com/KB/audio-video/">Audio and Video</A></DIV>
<DIV class=MI id=Section44><A 
href="http://www.codeproject.com/KB/directx/">DirectX</A></DIV>
<DIV class=MI id=Section46><A 
href="http://www.codeproject.com/KB/GDI/">GDI</A></DIV>
<DIV class=MI id=Section47><A 
href="http://www.codeproject.com/KB/GDI-plus/">GDI+</A></DIV>
<DIV class=MI id=Section43><A 
href="http://www.codeproject.com/KB/graphics/">General Graphics</A></DIV>
<DIV class=MI id=Section45><A 
href="http://www.codeproject.com/KB/openGL/">OpenGL</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter4');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=4">Database</A></DIV>
<DIV class=MenuSectionBlock id=Chapter4 style="DISPLAY: none">
<DIV class=MI id=Section66><A 
href="http://www.codeproject.com/KB/database/">Database</A></DIV>
<DIV class=MI id=Section100><A 
href="http://www.codeproject.com/KB/reporting-services/">SQL Reporting 
Services</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter8');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=8">Platforms, 
Frameworks &amp; Libraries</A></DIV>
<DIV class=MenuSectionBlock id=Chapter8>
<DIV class=MI id=Section83><A 
href="http://www.codeproject.com/KB/atl/">ATL</A></DIV>
<DIV class=MI id=Section117><A 
href="http://www.codeproject.com/KB/MFC/">MFC</A></DIV>
<DIV class=MI id=Section88><A 
href="http://www.codeproject.com/KB/stl/">STL</A></DIV>
<DIV class=MI id=Section84><A 
href="http://www.codeproject.com/KB/wtl/">WTL</A></DIV>
<DIV class=MI id=Section49><A href="http://www.codeproject.com/KB/COM/">COM / 
COM+</A></DIV>
<DIV class=MI id=Section76><A href="http://www.codeproject.com/KB/dotnet/">.NET 
Framework</A></DIV>
<DIV class=MI id=Section92><A 
href="http://www.codeproject.com/KB/winsdk/">Win32/64 SDK &amp; OS</A></DIV>
<DIV class=MI id=Section108><A href="http://www.codeproject.com/KB/vista/">Vista 
API</A></DIV>
<DIV class=MI id=Section110><A 
href="http://www.codeproject.com/KB/vista-security/">Vista Security</A></DIV>
<DIV class=MI id=Section82><A 
href="http://www.codeproject.com/KB/cross-platform/">Cross Platform</A></DIV>
<DIV class=MIS id=Section69><A href="http://www.codeproject.com/KB/game/">Game 
Development</A></DIV>
<DIV class=MI id=Section73><A 
href="http://www.codeproject.com/KB/mobile/">Mobile Development</A></DIV>
<DIV class=MI id=Section106><A href="http://www.codeproject.com/KB/WC/">Windows 
CardSpace</A></DIV>
<DIV class=MI id=Section103><A href="http://www.codeproject.com/KB/WCF/">Windows 
Communication Foundation</A></DIV>
<DIV class=MI id=Section104><A href="http://www.codeproject.com/KB/WPF/">Windows 
Presentation Foundation</A></DIV>
<DIV class=MI id=Section105><A href="http://www.codeproject.com/KB/WF/">Windows 
Workflow Foundation</A></DIV>
<DIV class=MI id=Section119><A 
href="http://www.codeproject.com/KB/library/">Libraries</A></DIV>
<DIV class=MI id=Section122><A 
href="http://www.codeproject.com/KB/powershell/">Windows Powershell</A></DIV>
<DIV class=MI id=Section123><A 
href="http://www.codeproject.com/KB/linq/">LINQ</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter5');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=5">Languages</A></DIV>
<DIV class=MenuSectionBlock id=Chapter5 style="DISPLAY: none">
<DIV class=MI id=Section71><A href="http://www.codeproject.com/KB/cpp/">C / C++ 
Language</A></DIV>
<DIV class=MI id=Section72><A href="http://www.codeproject.com/KB/mcpp/">C++ / 
CLI</A></DIV>
<DIV class=MI id=Section93><A 
href="http://www.codeproject.com/KB/cs/">C#</A></DIV>
<DIV class=MI id=Section78><A 
href="http://www.codeproject.com/KB/msil/">MSIL</A></DIV>
<DIV class=MI id=Section86><A 
href="http://www.codeproject.com/KB/vbscript/">VBScript</A></DIV>
<DIV class=MI id=Section87><A 
href="http://www.codeproject.com/KB/vb/">VB.NET</A></DIV>
<DIV class=MI id=Section115><A 
href="http://www.codeproject.com/KB/vb-interop/">VB6 Interop</A></DIV>
<DIV class=MI id=Section77><A 
href="http://www.codeproject.com/KB/net-languages/">Other .NET 
Languages</A></DIV>
<DIV class=MI id=Section21><A 
href="http://www.codeproject.com/KB/XML/">XML</A></DIV>
<DIV class=MI id=Section96><A 
href="http://www.codeproject.com/KB/java/">Java</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter6');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=6">General 
Programming</A></DIV>
<DIV class=MenuSectionBlock id=Chapter6 style="DISPLAY: none">
<DIV class=MI id=Section57><A 
href="http://www.codeproject.com/KB/recipes/">Algorithms &amp; Recipes</A></DIV>
<DIV class=MI id=Section64><A href="http://www.codeproject.com/KB/bugs/">Bugs 
&amp; Workarounds</A></DIV>
<DIV class=MI id=Section79><A 
href="http://www.codeproject.com/KB/collections/">Collections</A></DIV>
<DIV class=MI id=Section56><A 
href="http://www.codeproject.com/KB/security/">Cryptography &amp; 
Security</A></DIV>
<DIV class=MI id=Section50><A 
href="http://www.codeproject.com/KB/datetime/">Date and Time</A></DIV>
<DIV class=MI id=Section52><A href="http://www.codeproject.com/KB/DLL/">DLLs 
&amp; Assemblies</A></DIV>
<DIV class=MI id=Section80><A 
href="http://www.codeproject.com/KB/exception/">Exception Handling</A></DIV>
<DIV class=MI id=Section81><A 
href="http://www.codeproject.com/KB/locale/">Localisation</A></DIV>
<DIV class=MI id=Section53><A 
href="http://www.codeproject.com/KB/macros/">Macros and Add-ins</A></DIV>
<DIV class=MI id=Section54><A 
href="http://www.codeproject.com/KB/tips/">Programming Tips</A></DIV>
<DIV class=MI id=Section55><A 
href="http://www.codeproject.com/KB/string/">String handling</A></DIV>
<DIV class=MI id=Section22><A href="http://www.codeproject.com/KB/IP/">Internet 
/ Network</A></DIV>
<DIV class=MI id=Section58><A 
href="http://www.codeproject.com/KB/threads/">Threads, Processes &amp; 
IPC</A></DIV>
<DIV class=MI id=Section59><A 
href="http://www.codeproject.com/KB/winhelp/">WinHelp / HTMLHelp</A></DIV>
<DIV class=MI id=Section141><A 
href="http://www.codeproject.com/KB/answers/">Uncategorised Quick 
Answers</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter10');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=10">Graphics 
/ Design</A></DIV>
<DIV class=MenuSectionBlock id=Chapter10 style="DISPLAY: none">
<DIV class=MI id=Section40><A 
href="http://www.codeproject.com/KB/expression/">Expression</A></DIV>
<DIV class=MI id=Section114><A 
href="http://www.codeproject.com/KB/usability/">Usability</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter11');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=11">Development 
Lifecycle</A></DIV>
<DIV class=MenuSectionBlock id=Chapter11 style="DISPLAY: none">
<DIV class=MI id=Section51><A href="http://www.codeproject.com/KB/debug/">Debug 
Tips</A></DIV>
<DIV class=MI id=Section39><A 
href="http://www.codeproject.com/KB/architecture/">Design and 
Architecture</A></DIV>
<DIV class=MI id=Section112><A 
href="http://www.codeproject.com/KB/install/">Installation</A></DIV>
<DIV class=MI id=Section41><A href="http://www.codeproject.com/KB/work/">Work 
Issues</A></DIV>
<DIV class=MI id=Section128><A 
href="http://www.codeproject.com/KB/testing/">Testing and QA</A></DIV>
<DIV class=MI id=Section126><A 
href="http://www.codeproject.com/KB/codegen/">Code Generation</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter7');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=7">General 
Reading</A></DIV>
<DIV class=MenuSectionBlock id=Chapter7 style="DISPLAY: none">
<DIV class=MI id=Section60><A href="http://www.codeproject.com/KB/books/">Book 
Chapters</A></DIV>
<DIV class=MI id=Section61><A 
href="http://www.codeproject.com/KB/book-reviews/">Book Reviews</A></DIV>
<DIV class=MI id=Section109><A 
href="http://www.codeproject.com/KB/hardware-review/">Hardware Reviews</A></DIV>
<DIV class=MI id=Section63><A 
href="http://www.codeproject.com/KB/interviews/">Interviews</A></DIV>
<DIV class=MI id=Section62><A 
href="http://www.codeproject.com/KB/scrapbook/">Scrapbook</A></DIV>
<DIV class=MI id=Section48><A 
href="http://www.codeproject.com/KB/system/">Hardware &amp; System</A></DIV>
<DIV class=MI id=Section136><A 
href="http://www.codeproject.com/KB/Blogs/">Uncategorised Technical 
Blogs</A></DIV>
<DIV class=MI id=Section140><A 
href="http://www.codeproject.com/KB/mentor/">Author Resources</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter12');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=12">Third 
Party Products</A></DIV>
<DIV class=MenuSectionBlock id=Chapter12 style="DISPLAY: none">
<DIV class=MI id=Section65><A 
href="http://www.codeproject.com/KB/showcase/">Product Showcase</A></DIV>
<DIV class=MI id=Section124><A 
href="http://www.codeproject.com/KB/solution-center/">Solution 
Center</A></DIV></DIV>
<DIV class=MenuChapter><A onclick="return ToggleMenu('Chapter13');" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=13">Mentor 
Resources</A></DIV>
<DIV class=MenuSectionBlock id=Chapter13 style="DISPLAY: none"></DIV></DIV>
<DIV style="MARGIN-TOP: 5px"></DIV>
<DIV class=MenuCat>Services</DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/script/Catalog/List.aspx">Product 
Catalog</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/services/certificates/index.aspx">Code-signing 
Certificates</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/script/Jobs/List.aspx">Job Board</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/Services/Addins/">CodeProject VS2008 
Addin</A></DIV>
<DIV style="MARGIN-TOP: 5px"></DIV>
<DIV class=MenuCat>Feature Zones</DIV>
<DIV class=MenuChapter><A href="http://www.codeproject.com/kb/Showcase/">Product 
Showcase</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/redir.aspx?adid=11864">Code Signing 
Resources</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/Zones/WhitePapers/">WhitePapers / 
Webcasts</A></DIV>
<DIV class=MenuChapter><A 
href="http://www.codeproject.com/redir.aspx?adid=8763">ASP.NET Web 
Hosting</A></DIV>
<DIV style="MARGIN-TOP: 5px"></DIV>
<DIV style="MARGIN: auto; WIDTH: 150px">
<SCRIPT type=text/javascript>document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d10335%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20src%3d%22%2fscript%2fAdServe%2fServeImg.aspx%3fFile%3dCP_Insider_150x80_B.gif%26C%3dFalse%26adid%3d10335%26obid%3d11983%26obtid%3d2%22%20alt%3d%22%22%20border%3d%220%22%20width%3d%22150px%22%20height%3d%2280px%22%3e%3c%2fa%3e"));</SCRIPT>
</DIV>
<DIV style="MARGIN: 10px auto auto; WIDTH: 160px">
<SCRIPT type=text/javascript>document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d8678%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20src%3d%22%2fscript%2fAdServe%2fServeImg.aspx%3fFile%3dxoreax_160x600.gif%26C%3dFalse%26adid%3d8678%26obid%3d11983%26obtid%3d2%22%20alt%3d%22Xoreax%20cuts%20VS%20build%20times%20by%20up%20to%2090%25%22%20border%3d%220%22%20width%3d%22160px%22%20height%3d%22600px%22%3e%3c%2fa%3e"));</SCRIPT>
</DIV></DIV>
<DIV class="ArticlePane LeftColumn" id=ctl00_ArticlePane>
<TABLE class=SearchHeaderBar cellSpacing=0 width="100%">
  <TBODY>
  <TR>
    <TD width="100%">&nbsp;</TD>
    <TD style="WIDTH: 60%; WHITE-SPACE: nowrap" vAlign=center align=right>
      <FORM style="MARGIN: 0px" name=Search action=/info/search.aspx 
      method=get><B>Search &nbsp;</B> <INPUT class=SmallText 
      style="WIDTH: 200px" name=artkw> <SELECT class="SmallText offblack" 
      style="FONT-WEIGHT: bold" name=sbo> <OPTION value=kw 
        selected>Articles</OPTION> <OPTION value=fm>Messages</OPTION> <OPTION 
        value=s>Jobs</OPTION> <OPTION value=ctlk>Product Catalog</OPTION></SELECT> 
<INPUT class=SmallText style="FONT-WEIGHT: bold" type=submit value=" Go! "> 
      &nbsp; </FORM></TD>
    <TD class=TinyText style="WHITE-SPACE: nowrap"><A 
      href="http://www.codeproject.com/info/search.aspx">Advanced 
      Search</A><BR><A id=ctl00_SearchBarCtrl_AddToIESearchLnk 
      title="Add The Code Project to your IE search Providers" 
      onclick="window.external.AddSearchProvider('http://www.codeproject.com/info/OpenSearch.xml'); return false;" 
      href="http://www.codeproject.com/">Add to IE Search</A> 
</TD></TR></TBODY></TABLE><A name=Main></A><SPAN id=ctl00_ResultMessage></SPAN>
<DIV id=ctl00_ArtDiv>
<TABLE cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR vAlign=top>
    <TD vAlign=top width="100%">
      <TABLE>
        <TBODY></TBODY></TABLE>
      <DIV class=SmallText><IMG style="VERTICAL-ALIGN: middle" height=16 
      alt=print 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/print.gif" 
      width=16><A id=ctl00_ArticleHeaderLinks_PrintLnk 
      href="http://www.codeproject.com/KB/game/sudoku.aspx?display=Print">Print</A> 
      &nbsp; <SPAN id=SBI><IMG id=ctl00_ArticleHeaderLinks_AddTo_Img 
      style="VERTICAL-ALIGN: middle" height=16 alt=add 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/add.gif" 
      width=16> <A 
      href="http://www.codeproject.com/KB/game/sudoku.aspx#">Share</A></SPAN> 
      <DIV id=ATD></DIV>&nbsp; &nbsp; <IMG 
      id=ctl00_ArticleHeaderLinks_ArticleBmk_Img 
      style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; VERTICAL-ALIGN: middle; WIDTH: 16px; HEIGHT: 16px; BORDER-RIGHT-WIDTH: 0px" 
      alt=Bookmark 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/link.png"> 
      <A class="" id=ctl00_ArticleHeaderLinks_ArticleBmk_Lnk 
      onclick="return bookmarkMe(11983, 2);" 
      href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=11983&amp;obtid=2&amp;action=AddBookmark" 
      name=bm_11983_2>Bookmark</A> <SPAN class=TinyText 
      id=ctl00_ArticleHeaderLinks_ArticleBmk_StatusMsg style="DISPLAY: none" 
      name="bm_11983_2"></SPAN>&nbsp; <IMG style="VERTICAL-ALIGN: middle" 
      height=16 alt=Discuss 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/discuss.gif" 
      width=15> <A 
      href="http://www.codeproject.com/KB/game/sudoku.aspx#_comments">Discuss</A> 
      &nbsp; <IMG style="VERTICAL-ALIGN: middle" height=16 alt="Broken Article?" 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/report.gif" 
      width=16><A id=ctl00_ArticleHeaderLinks_BrokenLnk 
      href="http://www.codeproject.com/script/Articles/Report.aspx?aid=11983">Report</A> 
      &nbsp; </DIV></TD>
    <TD style="WIDTH: 100px; WHITE-SPACE: nowrap; TEXT-ALIGN: right">
      <TABLE id=ctl00_CurRat name="CurRat_11983">
        <TBODY>
        <TR>
          <TD>
            <TABLE>
              <TBODY>
              <TR>
                <TD class=SmallText id=ctl00_ArticleRating_VL 
                style="WHITE-SPACE: nowrap" align=right><SPAN 
                  id=ctl00_ArticleRating_VoteLabel>30 votes for this 
                  article.</SPAN> </TD>
                <TD>
                  <TABLE cellSpacing=0 cellPadding=0 border=1>
                    <TBODY>
                    <TR>
                      <TD align=left width=20 bgColor=white height=7><IMG 
                        height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/red.gif" 
                        width=20 align=middle border=0></TD>
                      <TD align=left width=20 bgColor=white height=7><IMG 
                        height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/red.gif" 
                        width=20 align=middle border=0></TD>
                      <TD align=left width=20 bgColor=white height=7><IMG 
                        height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/red.gif" 
                        width=20 align=middle border=0></TD>
                      <TD align=left width=20 bgColor=white height=7><IMG 
                        height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/red.gif" 
                        width=20 align=middle border=0></TD>
                      <TD 
                      style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; WHITE-SPACE: nowrap" 
                      align=left width=20 bgColor=white height=7><IMG height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/red.gif" 
                        width=5 align=middle border=0><IMG height=7 
                        src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/white.gif" 
                        width=15 align=middle border=0></TD></TR></TBODY></TABLE><SPAN 
                  class=SmallText id=ctl00_ArticleRating_Votes></SPAN></TD></TR>
              <TR id=ctl00_ArticleRating_PopularityRow>
                <TD class=SmallText align=right colSpan=2><A 
                  id=ctl00_ArticleRating_PopularityLnk 
                  title="Calculated as rating x Log10(# votes)" 
                  href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=1">Popularity: 
                  6.27</A> <SPAN 
                  id=ctl00_ArticleRating_PopularityLbl></SPAN><SPAN 
                  id=ratingVal>Rating: <B>4.24</B> out of 5</SPAN> 
            </TD></TR></TBODY></TABLE></TD>
          <TD>
            <DIV>
            <TABLE class=HistTable 
title="Voting Distribution. Recent data only">
              <TBODY>
              <TR>
                <TD><IMG title="3 votes, 10.0%" height=2 alt="3 votes, 10.0%" 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pollcol.gif" 
                  width=10 border=0><BR>1</TD>
                <TD><IMG title="1 vote, 3.3%" height=1 alt="1 vote, 3.3%" 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pollcol.gif" 
                  width=10 border=0><BR>2</TD>
                <TD><IMG title="" height=1 alt="" 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/t.gif" 
                  width=10 border=0><BR>3</TD>
                <TD><IMG title="3 votes, 10.0%" height=2 alt="3 votes, 10.0%" 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pollcol.gif" 
                  width=10 border=0><BR>4</TD>
                <TD><IMG title="23 votes, 76.7%" height=20 
                  alt="23 votes, 76.7%" 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pollcol.gif" 
                  width=10 
        border=0><BR>5</TD></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV id=contentdiv><!-- Main Page Contents Start --><!-- Article Starts -->
<UL class=download>
  <LI><A 
  href="http://www.codeproject.com/KB/game/sudoku/sudoku_src.zip">Download 
  source files - 7.51 Kb</A> 
  <LI><A 
  href="http://www.codeproject.com/KB/game/sudoku/sudoku_demo.zip">Download demo 
  project - 8.30 Kb</A> </LI></UL>
<P><IMG height=235 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/sudoku.jpg" 
width=249></P>
<H2>Introduction</H2>
<P>A while back a colleague of mine introduced me to a game called Sudoku. Me 
being totally ignorant of this game soon got the rules explained and then 
realized pretty quickly that it would be a lot faster to make a program for this 
than solve even one single puzzle!</P>
<H2>Sudoku rules</H2>
<P>The rules for Sudoku are simple. You have a board with 9x9 cells, the board 
is further divided into nine sub squares with 3x3 cells each. In every sub 
square, in vertical and horizontal lines, you have to put the numbers 1-9 one 
and only once.</P>
<P>When creating a Sudoku we must keep in mind that there can be only one 
solution for it, otherwise it is not considered a real Sudoku.</P>
<H2>Solve the puzzle</H2>
<P>When the class is initialized and a Sudoku puzzle has been set to solve we 
can let the function <CODE>Solve()</CODE> start its business. In each iteration 
we want to locate the spot on the board with the maximum information. We start 
with an initial set <CODE>M</CODE> with all possible solutions for the spot:</P><PRE lang=cs><SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Set M of possible solutions
</SPAN><SPAN class=code-keyword>byte</SPAN>[] M = {<SPAN class=code-digit>0</SPAN>,<SPAN class=code-digit>1</SPAN>,<SPAN class=code-digit>2</SPAN>,<SPAN class=code-digit>3</SPAN>,<SPAN class=code-digit>4</SPAN>,<SPAN class=code-digit>5</SPAN>,<SPAN class=code-digit>6</SPAN>,<SPAN class=code-digit>7</SPAN>,<SPAN class=code-digit>8</SPAN>,<SPAN class=code-digit>9</SPAN>};</PRE>
<P>We then remove all the used occurrences in the vertical direction:</P><PRE lang=cs><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> a = <SPAN class=code-digit>0</SPAN>; a &lt; <SPAN class=code-digit>9</SPAN>; a++)
    M[m_sudoku[a,x]] = <SPAN class=code-digit>0</SPAN>;</PRE>
<P>and the horizontal direction:</P><PRE lang=cs><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> b = <SPAN class=code-digit>0</SPAN>; b &lt; <SPAN class=code-digit>9</SPAN>; b++)
    M[m_sudoku[y,b]] = <SPAN class=code-digit>0</SPAN>;</PRE>
<P>Last, we remove all the used occurrences in the sub square. To speed up the 
feasibility test and simplify the code, I decided to use look-up tables for the 
sub squares. First, we get an index into the sub square table from our current 
position by using a table that maps locations to sub squares:</P><PRE lang=cs><SPAN class=code-keyword>int</SPAN> squareIndex = m_subSquare[y,x];</PRE>
<P>Then we get the actual position into the two-dimensional array by using a sub 
index array:</P><PRE lang=cs>point p = m_subIndex[squareIndex,c];
<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Yes, there is a Point structure but because it is in the
</SPAN><SPAN class=code-comment>//</SPAN><SPAN class=code-comment> System.Drawing namespace it feels more appropriate for 
</SPAN><SPAN class=code-comment>//</SPAN><SPAN class=code-comment> graphics use and therefore I made my own.</SPAN></PRE>
<P>This last code snippet is used inside a loop that removes all occurrences in 
the square:</P><PRE lang=cs><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> c = <SPAN class=code-digit>0</SPAN>; c &lt; <SPAN class=code-digit>9</SPAN>; c++)
{
    point p = m_subIndex[squareIndex,c];
    M[m_sudoku[p.x,p.y]] = <SPAN class=code-digit>0</SPAN>;
}</PRE>
<P>We then calculate the cardinality of the set <CODE>M</CODE>:</P><PRE lang=cs><SPAN class=code-keyword>int</SPAN> cM = <SPAN class=code-digit>0</SPAN>;
<SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> d = <SPAN class=code-digit>1</SPAN>; d &lt; <SPAN class=code-digit>10</SPAN>; d++)
    cM += M[d] == <SPAN class=code-digit>0</SPAN> ? <SPAN class=code-digit>0</SPAN> : <SPAN class=code-digit>1</SPAN>;</PRE>
<P>If the cardinality of the current set is less than the smallest before that, 
the current spot is the best evaluated so far:</P><PRE lang=cs><SPAN class=code-keyword>if</SPAN>(cM &lt; cMp)
{
    cMp = cM;
    Mp = M;
    xp = x;
    yp = y;
}</PRE>
<P>The smallest cardinality <CODE>cMp</CODE> was initially set to 10 and if that 
hasn't been changed we can be certain that there are no empty spots on the board 
and we can exit successfully:</P><PRE lang=cs><SPAN class=code-keyword>if</SPAN>(cMp == <SPAN class=code-digit>10</SPAN>)
    <SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>true</SPAN>;</PRE>
<P>On the other hand, if the cardinality of the smallest set was 0, i.e. there 
was an empty set <CODE>M</CODE> of feasible elements we can be sure that there 
isn't a solution and we have to back track:</P><PRE lang=cs><SPAN class=code-keyword>if</SPAN>(cMp == <SPAN class=code-digit>0</SPAN>)
    <SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>false</SPAN>;</PRE>
<P>When all the base cases have been accounted for we can start the iterative 
process that tries every element of <CODE>M</CODE> in turn:</P><PRE lang=cs><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> i = <SPAN class=code-digit>1</SPAN>; i &lt; <SPAN class=code-digit>10</SPAN>; i++)
{
    <SPAN class=code-keyword>if</SPAN>(Mp[i] != <SPAN class=code-digit>0</SPAN>)
    {
        m_sudoku[yp,xp] = Mp[i];
        <SPAN class=code-keyword>if</SPAN>(Solve())
            <SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>true</SPAN>;
    }
}

<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Restore to original state.
</SPAN>m_sudoku[yp,xp] = <SPAN class=code-digit>0</SPAN>;
<SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>false</SPAN>;</PRE>
<P>The loop replaces the unused spot with each element of <CODE>M</CODE> in turn 
and tries to solve in a recursive manner. When <CODE>M</CODE> gets exhausted we 
return <CODE lang=cs><SPAN class=code-keyword>false</SPAN></CODE> indicating 
there is no solution. If the function returned successfully a solution can be 
read in the <CODE>Data</CODE> property as in the example:</P><PRE lang=cs>...
Sudoku s = <SPAN class=code-keyword>new</SPAN> Sudoku();
s.Data = SudokuToSolveFor;
<SPAN class=code-keyword>if</SPAN>(s.Solve())
    <SPAN class=code-keyword>byte</SPAN>[,] SudokuSolved = s.Data;
<SPAN class=code-keyword>else</SPAN>
    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> No solution
</SPAN>...</PRE>
<H2>Generate a Sudoku</H2>
<P>I soon realized that it was too boring entering Sudokus by hand and set for 
the task to generate them. My requirements were that you should be able to 
indicate how many spots should be filled in and give a possible start pattern. 
If the possible start pattern didn't work out on the first try it could be 
thrown away and an entire new pattern could be generated, otherwise we might be 
stuck with a pattern that doesn't have a solution, and considering the size of 
the entire Sudoku space that is quite bad complexity wise.</P>
<P>The function <CODE lang=cs>Generate(<SPAN class=code-keyword>int</SPAN> 
nodes)</CODE> is where all the functionality is located. We start by calculating 
how many spots are used in the current data set and then decide whether we'll 
start up fresh or generate an entire new Sudoku:</P><PRE lang=cs><SPAN class=code-keyword>int</SPAN> num = GetNumberSpots();

<SPAN class=code-keyword>if</SPAN>(!IsSudokuFeasible() || num &gt; nodes)
{
    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> The supplied data is not feasible, clear data.
</SPAN>    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> - or -
</SPAN>    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> The supplied data has too many nodes set, clear data.
</SPAN>    Clear();
    num = <SPAN class=code-digit>0</SPAN>;
}</PRE>
<P>The set number of spots are generated and then the Sudoku is tested for 
uniqueness:</P><PRE lang=cs><SPAN class=code-keyword>do</SPAN>
{
    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Try to generate spots
</SPAN>    <SPAN class=code-keyword>if</SPAN>(Gen(spots - num))
    {
        <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Test if unique solution.
</SPAN>        <SPAN class=code-keyword>if</SPAN>(IsSudokuUnique())
        {
            <SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>true</SPAN>;
        }
    }
    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Start over.
</SPAN>    Clear();
    num = <SPAN class=code-digit>0</SPAN>;
} <SPAN class=code-keyword>while</SPAN>(<SPAN class=code-keyword>true</SPAN>);</PRE>
<P>This loop goes on forever until a solution has been found. There is room for 
improvement here if we want to be able to abort in mid search. The <CODE 
lang=cs>Gen(<SPAN class=code-keyword>int</SPAN> spots)</CODE> function starts by 
generating a random spot on the 9x9 board:</P><PRE lang=cs><SPAN class=code-keyword>do</SPAN>
{
    xRand = rnd.Next(<SPAN class=code-digit>9</SPAN>);
    yRand = rnd.Next(<SPAN class=code-digit>9</SPAN>);
} <SPAN class=code-keyword>while</SPAN>(m_sudoku[yRand,xRand] != <SPAN class=code-digit>0</SPAN>);</PRE>
<P>For each randomized spot we have to check for the feasible values, pretty 
much done in the same style as in the solver:</P><PRE lang=cs><SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Set M of possible solutions
</SPAN><SPAN class=code-keyword>byte</SPAN>[] M = {<SPAN class=code-digit>0</SPAN>,<SPAN class=code-digit>1</SPAN>,<SPAN class=code-digit>2</SPAN>,<SPAN class=code-digit>3</SPAN>,<SPAN class=code-digit>4</SPAN>,<SPAN class=code-digit>5</SPAN>,<SPAN class=code-digit>6</SPAN>,<SPAN class=code-digit>7</SPAN>,<SPAN class=code-digit>8</SPAN>,<SPAN class=code-digit>9</SPAN>};

<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Remove used numbers in the vertical direction
</SPAN><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> a = <SPAN class=code-digit>0</SPAN>; a &lt; <SPAN class=code-digit>9</SPAN>; a++)
    M[m_sudoku[a,xRand]] = <SPAN class=code-digit>0</SPAN>;

<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Remove used numbers in the horizontal direction
</SPAN><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> b = <SPAN class=code-digit>0</SPAN>; b &lt; <SPAN class=code-digit>9</SPAN>; b++)
    M[m_sudoku[yRand,b]] = <SPAN class=code-digit>0</SPAN>;

<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Remove used numbers in the sub square.
</SPAN><SPAN class=code-keyword>int</SPAN>    squareIndex = m_subSquare[yRand,xRand];
<SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> c = <SPAN class=code-digit>0</SPAN>; c &lt; <SPAN class=code-digit>9</SPAN>; c++)
{
    point p = m_subIndex[squareIndex,c];
    M[m_sudoku[p.x,p.y]] = <SPAN class=code-digit>0</SPAN>;
}

<SPAN class=code-keyword>int</SPAN> cM = <SPAN class=code-digit>0</SPAN>;
<SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Calculate cardinality of M
</SPAN><SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> d = <SPAN class=code-digit>1</SPAN>; d &lt; <SPAN class=code-digit>10</SPAN>; d++)
    cM += M[d] == <SPAN class=code-digit>0</SPAN> ? <SPAN class=code-digit>0</SPAN> : <SPAN class=code-digit>1</SPAN>;</PRE>
<P>If the cardinality is larger than zero we get a random sample from the 
feasible set <CODE>M</CODE>:</P><PRE lang=cs><SPAN class=code-keyword>if</SPAN>(cM &gt; <SPAN class=code-digit>0</SPAN>)
{
    <SPAN class=code-keyword>int</SPAN> e = <SPAN class=code-digit>0</SPAN>;

    <SPAN class=code-keyword>do</SPAN>
    {
        <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Randomize number from the feasible set M
</SPAN>        e =  rnd.Next(<SPAN class=code-digit>1</SPAN>,<SPAN class=code-digit>10</SPAN>);
    } <SPAN class=code-keyword>while</SPAN>(M[e] == <SPAN class=code-digit>0</SPAN>);

    <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Set number in Sudoku
</SPAN>    m_sudoku[yRand,xRand] = (<SPAN class=code-keyword>byte</SPAN>)e;
}</PRE>
<P>If the set <CODE>M</CODE> is empty this can't be a Sudoku and we restart the 
process until we find a non-empty set <CODE>M</CODE>. When all the given spots 
have been generated we try for uniqueness in the function 
<CODE>TestUniquness()</CODE>. The test for uniqueness is done by trying to 
generate more than one solution; as soon as more than one exists the generated 
set will not be feasible and a new one is generated:</P><PRE lang=cs>... <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> same as in Solve()
</SPAN>
<SPAN class=code-keyword>int</SPAN> success = <SPAN class=code-digit>0</SPAN>;
<SPAN class=code-keyword>for</SPAN>(<SPAN class=code-keyword>int</SPAN> i = <SPAN class=code-digit>1</SPAN>; i &lt; <SPAN class=code-digit>10</SPAN>; i++)
{
    <SPAN class=code-keyword>if</SPAN>(Mp[i] != <SPAN class=code-digit>0</SPAN>)
    {
        m_sudoku[yp,xp] = Mp[i];
        <SPAN class=code-keyword>if</SPAN>(TestUniqueness())
            success++;

        <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> Restore to original state.
</SPAN>        m_sudoku[yp,xp] = <SPAN class=code-digit>0</SPAN>;

        <SPAN class=code-comment>//</SPAN><SPAN class=code-comment> More than one solution found?
</SPAN>        <SPAN class=code-keyword>if</SPAN>(success &gt; <SPAN class=code-digit>1</SPAN>)
            <SPAN class=code-keyword>return</SPAN> <SPAN class=code-keyword>false</SPAN>;
    }
}

<SPAN class=code-keyword>return</SPAN> success == <SPAN class=code-digit>1</SPAN>;</PRE>
<H2>Sample application</H2>
<P>To demonstrate how to use the class, I have made a small, rudimentary 
application using Windows Forms. From this you can generate, solve, print, load 
and save Sudokus.</P>
<H2>History</H2>
<UL>
  <LI>18<SUP>th</SUP> October, 2005 - Article submission. 
  <LI>2<SUP>nd</SUP> October, 2005 - Windows Forms framework. 
  <LI>25<SUP>th</SUP> September, 2005 - Sudoku class. </LI></UL><!-- Main Page Contents End --></DIV>
<FORM id=aspnetForm 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px" 
name=aspnetForm action=DisplayArticle.aspx method=post>
<DIV><INPUT id=__VIEWSTATE type=hidden 
value=/wEPDwUKMTAyMTMzODg1Ng9kFgJmD2QWBAIKD2QWBAIDDw8WAh4HVmlzaWJsZWdkZAILDw8WAh8AZ2RkAgsPZBYKAgcPZBYMAgEPZBYCZg8WAh4LXyFJdGVtQ291bnRmZAIDD2QWCGYPDxYCHgtOYXZpZ2F0ZVVybAUiL0tCL2dhbWUvc3Vkb2t1LmFzcHg/ZGlzcGxheT1QcmludGRkAgIPDxYCHwBoZGQCAw9kFgYCAg8PFgIeCEltYWdlVXJsBSEvc2NyaXB0L0Jvb2ttYXJrcy9JbWFnZXMvbGluay5wbmdkZAIEDw8WAh8CBUAvc2NyaXB0L0Jvb2ttYXJrcy9BZGQuYXNweD9vYmlkPTExOTgzJm9idGlkPTImYWN0aW9uPUFkZEJvb2ttYXJrFgYeBG5hbWUFCmJtXzExOTgzXzIeBWNsYXNzZR4Hb25jbGljawUccmV0dXJuIGJvb2ttYXJrTWUoMTE5ODMsIDIpO2QCBg8WAh8EBQpibV8xMTk4M18yZAIEDw8WAh8CBSYvc2NyaXB0L0FydGljbGVzL1JlcG9ydC5hc3B4P2FpZD0xMTk4M2RkAgUPFgIfBAUMQ3VyUmF0XzExOTgzFgJmD2QWAmYPZBYCZg9kFgQCAQ9kFgICAQ8PFgIeBFRleHQFGjMwIHZvdGVzIGZvciB0aGlzIGFydGljbGUuZGQCBw9kFgJmD2QWBAIBDw8WBB8HBRBQb3B1bGFyaXR5OiA2LjI3HwIFKS9zY3JpcHQvQXJ0aWNsZXMvVG9wQXJ0aWNsZXMuYXNweD90YV9zbz0xZGQCBQ8WAh8HBRxSYXRpbmc6IDxiPjQuMjQ8L2I+IG91dCBvZiA1ZAIZD2QWCgIBD2QWBAIBDxYCHglpbm5lcmh0bWwFsQI8cD5UaGlzIGFydGljbGUgaGFzIG5vIGV4cGxpY2l0IGxpY2Vuc2UgYXR0YWNoZWQgdG8gaXQgYnV0IG1heSBjb250YWluIHVzYWdlIHRlcm1zIGluIHRoZSBhcnRpY2xlIHRleHQgb3IgdGhlIGRvd25sb2FkIGZpbGVzIHRoZW1zZWx2ZXMuIElmIGluIGRvdWJ0IHBsZWFzZSBjb250YWN0IHRoZSBhdXRob3IgdmlhIHRoZSBkaXNjdXNzaW9uIGJvYXJkIGJlbG93LjwvcD48cD5BIGxpc3Qgb2YgbGljZW5zZXMgYXV0aG9ycyBtaWdodCB1c2UgY2FuIGJlIGZvdW5kIDxhIGhyZWY9Ii9pbmZvL0xpY2Vuc2VzLmFzcHgiPmhlcmU8L2E+PC9wPmQCAg9kFgICAQ8QZGQWAGQCBQ8WAh8BAgFkAgcPFgIfBwX8BjxoMj5PdGhlciBwb3B1bGFyIEdhbWUgRGV2ZWxvcG1lbnQgYXJ0aWNsZXM6PC9oMj48dWw+PGxpPjxhIGhyZWY9Ii9LQi9nYW1lL0FJX0xpZmUuYXNweCI+QUkgTGlmZTwvYT48ZGl2IGNsYXNzPSJTbWFsbFRleHQiPlN0ZWVyaW5nIEJlaGF2aW91cnMsIEdlbmV0aWMgQWxnb3JpdGhtcywgYW5kIE5ldXJhbCBOZXR3b3JrcyBpbiBnYW1lczwvZGl2PjwvbGk+PGxpPjxhIGhyZWY9Ii9LQi9nYW1lL3JldmVyc2kuYXNweCI+UmV2ZXJzaSBpbiBDIzwvYT48ZGl2IGNsYXNzPSJTbWFsbFRleHQiPlRoZSBnYW1lIG9mIFJldmVyc2kgaW4gQyMuPC9kaXY+PC9saT48bGk+PGEgaHJlZj0iL0tCL2dhbWUvc3RhcnRyZWtfMTk3MV90ZXh0LmFzcHgiPlN0YXIgVHJlayAxOTcxIFRleHQgR2FtZTwvYT48ZGl2IGNsYXNzPSJTbWFsbFRleHQiPkEgcmV3b3JraW5nIG9mIHRoZSAxOTcxIFN0YXIgVHJlayB0ZXh0IGdhbWUgdXNpbmcgQyM8L2Rpdj48L2xpPjxsaT48YSBocmVmPSIvS0IvZ2FtZS9wYXJ0aWNsZXNzeXN0ZW1zLmFzcHgiPkEgYmFzaWMgUGFydGljbGVzIFN5c3RlbTwvYT48ZGl2IGNsYXNzPSJTbWFsbFRleHQiPkludHJvZHVjdGlvbiB0byB0aGUgYmFzaWMgaWRlYSBvZiB0aGUgcGFydGljbGUgc3lzdGVtcywgYW5kIGhvdyB0byBjcmVhdGUgYmFzaWMgZWZmZWN0cyBzdWNoIGFzIGV4cGxvc2lvbnMgYW5kIHdhdGVyIGZvdW50YWlucy48L2Rpdj48L2xpPjxsaT48YSBocmVmPSIvS0IvZ2FtZS9wb2tlcmhhbmRldmFsZG9jLmFzcHgiPkZhc3QsIFRleGFzIEhvbGRlbSBIYW5kIEV2YWx1YXRpb24gYW5kIEFuYWx5c2lzPC9hPjxkaXYgY2xhc3M9IlNtYWxsVGV4dCI+QSBDIyBuYXRpdmUsIGZhc3QgVGV4YXMgSG9sZGVtIEhhbmQgRXZhbHVhdG9yLjwvZGl2PjwvbGk+PC91bD5kAgkPDxYCHwBnZGQCCw9kFgJmD2QWAgIBD2QWAmYPZBYCZg8WBB8EBQ5SYXRlSXRlbV8xMTk4Mx8FZRYCAgYPZBYCAgEPD2QWAh8GBSNyZXR1cm4gcmF0ZUl0ZW0oMTE5ODMsMix0cnVlLHRydWUpO2QCGw8PFgIfAGdkZAIhDxYCHwBoZAILDw8WAh8CBScvc2NyaXB0L0FydGljbGVzL0FydGljbGUuYXNweD9haWQ9MTE5ODNkZAIRDxYCHwcFCjggTm92IDIwMDVkAhMPDxYEHwcFDlNtaXRoYSBWaWpheWFuHwIFJi9zY3JpcHQvTWVtYmVyc2hpcC9WaWV3LmFzcHg/bWlkPTI4OTcwZGQCFQ8WAh8HBSBDb3B5cmlnaHQgMjAwNSBieSBKcmdlbiBQcmFtYmVyZ2RkI2SxvYUqL2orf+x9P/cN0lXdWOk= 
name=__VIEWSTATE> </DIV>
<DIV><INPUT id=__EVENTVALIDATION type=hidden 
value=/wEWCALh3piICwLAlMXDBwLBlMXDBwLClMXDBwLDlMXDBwLElMXDBwLP+++tCwK5upDkCwRZe2xNcxh/lbYEo76aPpu+02VI 
name=__EVENTVALIDATION> </DIV>
<H2>License</H2>
<DIV id=ctl00_LicenseTerms>
<P>This article has no explicit license attached to it but may contain usage 
terms in the article text or the download files themselves. If in doubt please 
contact the author via the discussion board below.</P>
<P>A list of licenses authors might use can be found <A 
href="http://www.codeproject.com/info/Licenses.aspx">here</A></P></DIV>
<H2>About the Author</H2>
<TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR vAlign=top>
    <TD id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberPhotoTable 
    style="WIDTH: 155px" vAlign=top><B><A 
      id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberProfileLink 
      href="http://www.codeproject.com/Members/Jrgen-Pramberg">Jrgen 
      Pramberg</A></B><BR><BR>
      <CENTER><IMG id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberPhoto 
      style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" 
      src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/{6EA02540-5E0B-4373-B364-4FBB332A7368}.jpg"></CENTER><BR><SPAN 
      class=SmallText 
      id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberType>Member</SPAN> </TD>
    <TD><BR>
      <TABLE>
        <TBODY>
        <TR id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_jobTitleRow>
          <TD class=SmallText noWrap>Occupation: </TD>
          <TD width="100%"><SPAN class=SmallText 
            id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberJobTitle>Web 
            Developer</SPAN></TD></TR>
        <TR id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_locationRow>
          <TD class=SmallText>Location: </TD>
          <TD width="100%"><SPAN class=SmallText 
            id=ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberLocation><IMG 
            height=11 alt=Sweden 
            src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/SE.gif" 
            width=16> Sweden</SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR vAlign=top>
    <TD style="WIDTH: 100%">
      <H2>Other popular Game Development articles:</H2>
      <UL>
        <LI><A href="http://www.codeproject.com/KB/game/AI_Life.aspx">AI 
Life</A>
        <DIV class=SmallText>Steering Behaviours, Genetic Algorithms, and Neural 
        Networks in games</DIV>
        <LI><A href="http://www.codeproject.com/KB/game/reversi.aspx">Reversi in 
        C#</A>
        <DIV class=SmallText>The game of Reversi in C#.</DIV>
        <LI><A 
        href="http://www.codeproject.com/KB/game/startrek_1971_text.aspx">Star 
        Trek 1971 Text Game</A>
        <DIV class=SmallText>A reworking of the 1971 Star Trek text game using 
        C#</DIV>
        <LI><A href="http://www.codeproject.com/KB/game/particlessystems.aspx">A 
        basic Particles System</A>
        <DIV class=SmallText>Introduction to the basic idea of the particle 
        systems, and how to create basic effects such as explosions and water 
        fountains.</DIV>
        <LI><A 
        href="http://www.codeproject.com/KB/game/pokerhandevaldoc.aspx">Fast, 
        Texas Holdem Hand Evaluation and Analysis</A>
        <DIV class=SmallText>A C# native, fast Texas Holdem Hand 
        Evaluator.</DIV></LI></UL></TD>
    <TD><IFRAME src="javascript:''" frameBorder=0 width=300 scrolling=no 
      height=250></IFRAME></TD></TR></TBODY></TABLE>
<TABLE class=RatingBar id=ctl00_RateArticleRow cellSpacing=0 cellPadding=0 
width="100%" border=0>
  <TBODY>
  <TR>
    <TD><A href="http://www.codeproject.com/KB/game/sudoku.aspx#_top">Article 
      Top</A></TD>
    <TD align=right>
      <DIV class="" id=ctl00_RateArticle_RateItemWrapper style="DISPLAY: none" 
      name="RateItem_11983">
      <TABLE cellSpacing=0 cellPadding=0 width="100%">
        <TBODY>
        <TR>
          <TD id=ctl00_RateArticle_VoteResultDiv noWrap align=right 
            width="100%"><SPAN class=voteRes></SPAN><IMG class=loaderImg 
            style="DISPLAY: none" height=16 alt=loading... 
            src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/ajax-loader.gif" 
            width=16> </TD>
          <TD class=voteTbl style="WHITE-SPACE: nowrap" align=right>
            <TABLE class="">
              <TBODY>
              <TR vAlign=center>
                <TD id=ctl00_RateArticle_RateText 
                style="PADDING-RIGHT: 5px; WHITE-SPACE: nowrap"><I><B>Rate 
                  this article for us!</B></I> </TD>
                <TD id=ctl00_RateArticle_StartForm 
                  align=right><I>&nbsp;&nbsp;Poor</I> </TD>
                <TD id=ctl00_RateArticle_VoteFormDiv style="WHITE-SPACE: nowrap" 
                align=left>
                  <TABLE id=ctl00_RateArticle_VoteRBL border=0>
                    <TBODY>
                    <TR>
                      <TD><INPUT id=ctl00_RateArticle_VoteRBL_0 
                        onclick="ChkRtctl00_RateArticle(1, 11983);" type=radio 
                        value=1 name=ctl00$RateArticle$VoteRBL></TD>
                      <TD><INPUT id=ctl00_RateArticle_VoteRBL_1 
                        onclick="ChkRtctl00_RateArticle(2, 11983);" type=radio 
                        value=2 name=ctl00$RateArticle$VoteRBL></TD>
                      <TD><INPUT id=ctl00_RateArticle_VoteRBL_2 
                        onclick="ChkRtctl00_RateArticle(3, 11983);" type=radio 
                        value=3 name=ctl00$RateArticle$VoteRBL></TD>
                      <TD><INPUT id=ctl00_RateArticle_VoteRBL_3 
                        onclick="ChkRtctl00_RateArticle(4, 11983);" type=radio 
                        value=4 name=ctl00$RateArticle$VoteRBL></TD>
                      <TD><INPUT id=ctl00_RateArticle_VoteRBL_4 
                        onclick="ChkRtctl00_RateArticle(5, 11983);" type=radio 
                        value=5 
                  name=ctl00$RateArticle$VoteRBL></TD></TR></TBODY></TABLE></TD>
                <TD id=ctl00_RateArticle_EndForm align=left><I>Excellent</I> 
                </TD>
                <TD id=ctl00_RateArticle_VoteBtn><INPUT class=FormButton id=ctl00_RateArticle_SubmitRateBtn onclick="return rateItem(11983,2,true,true);" type=submit value=Vote name=ctl00$RateArticle$SubmitRateBtn> 
                </TD>
                <TD><SPAN 
              id=ctl00_RateArticle_ErrorMessage></SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <DIV class=RateComDiv id=RCD style="DISPLAY: none">
      <TABLE width="100%">
        <TBODY>
        <TR vAlign=top>
          <TD align=right width="100%">Your reason for this vote:</TD>
          <TD><TEXTAREA class=RateComment style="FLOAT: right; WIDTH: 285px" rows=5 cols=60></TEXTAREA> 
          </TD></TR></TBODY></TABLE></DIV></DIV></TD></TR></TBODY></TABLE></FORM>
<DIV 
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; MARGIN-LEFT: 40px; OVERFLOW: hidden; PADDING-TOP: 10px; WHITE-SPACE: nowrap">
<SCRIPT type=text/javascript>document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d12213%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20src%3d%22%2fscript%2fAdServe%2fServeImg.aspx%3fFile%3dSpreadsheetgear_Aug26th_SG468x60_2.gif%26C%3dFalse%26adid%3d12213%26obid%3d11983%26obtid%3d2%22%20alt%3d%22%22%20border%3d%220%22%20width%3d%22468px%22%20height%3d%2260px%22%3e%3c%2fa%3e"));</SCRIPT>
</DIV><A name=_comments></A><!-- Forum Start -->
<DIV id=_MessageBoard onclick="return SwitchMessage(event, null)">
<TABLE class=Frm_MainTable id=ForumTable cellSpacing=0 cellPadding=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
        <TBODY>
        <TR class=Frm_HeaderRow1>
          <TD style="WHITE-SPACE: nowrap"><IMG height=16 alt=FAQ 
            src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/forum_faq.gif" 
            width=16 align=middle border=0>&nbsp;<A 
            href="http://www.codeproject.com/script/Forums/FAQ.aspx"><B>FAQ</B></A>&nbsp;</TD>
          <TD style="WHITE-SPACE: nowrap; TEXT-ALIGN: right">
            <FORM 
            style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px" 
            action=/script/Forums/Search.aspx?fid=0 method=get><INPUT 
            type=hidden value=225854 name=fid><INPUT class=Frm_Input 
name=kw>&nbsp;<INPUT class=Frm_Button type=submit value=Search name=FrmSrch> 
            </FORM></TD>
          <TD style="TEXT-ALIGN: right"></TD></TR>
        <TR class=Frm_HeaderRow2>
          <TD style="WIDTH: 100%" colSpan=2>
            <DIV style="TEXT-ALIGN: right">
            <FORM 
            style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px" 
            action=/script/Forums/SetOptions.aspx?floc=%2fKB%2fgame%2fsudoku.aspx&amp;fid=225854 
            method=get><INPUT type=hidden value=225854 name=fid><INPUT 
            type=hidden value=?floc=%2fKB%2fgame%2fsudoku.aspx&amp;fid=225854 
            name=currentQS><INPUT type=hidden value=/KB/game/sudoku.aspx 
            name=floc>Noise Tolerance<SELECT class=Frm_DropDown size=1 
            name=noise> <OPTION value=1>Very High</OPTION><OPTION 
              value=2>High</OPTION><OPTION value=3 
              selected>Medium</OPTION><OPTION value=4>Low</OPTION><OPTION 
              value=5>Very Low</OPTION></SELECT>&nbsp;&nbsp;Layout<SELECT 
            class=Frm_DropDown size=1 name=view> <OPTION value=Quick 
              selected>Normal</OPTION><OPTION value=Topic>Expand Posts 
              only</OPTION><OPTION value=Expanded>Expand Posts &amp; 
              Replies</OPTION><OPTION value=Thread>Thread View</OPTION><OPTION 
              value=Normal>No Javascript</OPTION><OPTION value=Preview>No JS + 
              Preview</OPTION></SELECT>&nbsp;&nbsp;Per page<SELECT 
            class=Frm_DropDown size=1 name=mpp> <OPTION 
              value=10>10</OPTION><OPTION value=25 selected>25</OPTION><OPTION 
              value=50>50</OPTION></SELECT>&nbsp;&nbsp;&nbsp;<INPUT class=Frm_Button type=submit value=Update name=SetOpt> 
            </FORM></DIV></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD><A name=xx0xx></A>
      <TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
        <TBODY>
        <TR class=Frm_NavigationBar>
          <TD><IMG height=16 alt=new 
            src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/forum_newmsg.gif" 
            width=16 align=top border=0><A class=Frm_HL 
            title="Create a new message thread" 
            href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;floc=/KB/game/sudoku.aspx" 
            target=_top name=Frm_HoverNL><B>New Message</B></A></TD>
          <TD>Msgs 1 to 25 of 37 (Total in Forum: 37) (<A 
            href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854">Refresh</A>)</TD>
          <TD style="WHITE-SPACE: nowrap; TEXT-ALIGN: right"><SPAN 
            class=Frm_HL>First</SPAN><SPAN class=Frm_HL>Prev</SPAN><A 
            class=Frm_HL 
            href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;fr=26#xx0xx" 
            name=Frm_HoverNL>Next</A></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD>
      <TABLE class=Frm_MsgTable cellSpacing=0 cellPadding=0 width="100%" 
      border=0>
        <TBODY>
        <TR>
          <TD><IMG height=5 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd Rt HdUnSel " id=F3229333_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx3229333xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/3229333/Dissapointing.aspx" 
                  name=3229333>Dissapointing</A> <A title="Click to pin message" 
                  onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=4818277">disco</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">17:31 9 Oct 
                  '09 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F3229333_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Well that was a disappointment. I 
                              applied the patch as recommended by the author, 
                              and it still produces non-unique puzzles, claiming 
                              they are unique. I ran the puzzle generated by 
                              this program through the dancing links algorithm, 
                              which said there were many many solutions. 
                              <BR><BR>I really wish people would test their code 
                              before posting it.<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=3229333&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=3229333&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=3229333">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/3229333/Dissapointing.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3229333&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF3229333 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(4818277,3229333,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd LoVote Rt HdUnSel " id=F3062026_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx3062026xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/3062026/the-best-sudoku-solver.aspx" 
                  name=3062026>the best sudoku solver</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=6194907">karakaya13</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">5:26 1 Jun 
                  '09 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F3062026_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>thank, i am 13 years old and i have 
                              done a sudoku with the same algoritm in vba excel. 
                              And it run <IMG alt=Smile 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_smile.gif" 
                              align=top>, now i begin with c#,it is 
                            harder.<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=3062026&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=3062026">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/3062026/the-best-sudoku-solver.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3062026&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF3062026 
                              style="WHITE-SPACE: nowrap">2.33/5 (2 votes)
                              <SCRIPT type=text/javascript>
												MsgVFrm(6194907,3062026,false,"","","");
											</SCRIPT>
                               
              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd Rt HdUnSel " id=F1973757_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx1973757xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1973757/Very-good-example.aspx" 
                  name=1973757>Very good example</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=465690">thanhtungo</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">22:49 3 Apr 
                  '07 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1973757_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>It's very cool.<IMG alt=Smile 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_smile.gif" 
                              align=top><IMG alt="Big Grin" 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_biggrin.gif" 
                              align=top> <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1973757&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1973757&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1973757">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1973757/Very-good-example.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1973757&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1973757 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(465690,1973757,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd Rt HdUnSel " id=F1883203_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx1883203xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1883203/Not-unique.aspx" 
                  name=1883203>Not unique</A> <A title="Click to pin message" 
                  onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=2637370">Subgurim</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">20:32 7 Feb 
                  '07 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1883203_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Does anyone solved the 
                              NON-Uniqueness??<BR><BR>The commented code was the 
                              original one, and the uncommented the solution 
                              proposed by Jorguen, but that still doesn't 
                              works:<BR><BR>int success = 0;<BR>/*for(int i = 1; 
                              i &lt; 10; i++)<BR>{<BR>if(Mp[i] != 
                              0)<BR>{<BR>m_sudoku[yp,xp] = 
                              Mp[i];<BR>if(TestUniqueness())<BR>success++;<BR><BR>// 
                              Restore to original state.<BR>m_sudoku[yp,xp] = 
                              0;<BR><BR>// More than one solution 
                              found?<BR>if(success &gt; 1)<BR>return 
                              false;<BR>}<BR>}<BR><BR>return success == 
                              1;*/<BR><BR><BR><BR>for (int i = 1; i &lt; 10; 
                              i++)<BR>{<BR>if (Mp[i] != 0)<BR>{<BR>m_sudoku[yp, 
                              xp] = Mp[i];<BR>if 
                              (TestUniqueness())<BR>success++;<BR><B>else<BR>break;</B><BR><BR>// 
                              Restore to original state.<BR>m_sudoku[yp, xp] = 
                              0;<BR><BR>// More than one solution found?<BR>if 
                              (success &gt; 
                              1)<BR>break;<BR>}<BR>}<BR><BR><BR>Any 
                              help?<BR><BR>A lot of thanks in advance <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1883203&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1883203&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1883203">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1883203/Not-unique.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1883203&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1883203 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(2637370,1883203,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1883947_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=34><A name=xx1883947xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1883947/Re-Not-unique.aspx" 
                  name=1883947>Re: Not unique</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=2637370">Subgurim</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">6:55 8 Feb 
                  '07 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1883947_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 34px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=34></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hi,<BR><BR>my last code doesn't 
                              works, but I think I've finally found the 
                              solution. <BR><BR>I'm not sure of it, and I should 
                              test it much more, so if any other have found 
                              another solution please share it <IMG 
                              alt="Poke tongue" 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_tongue.gif" 
                              align=top><BR><BR><BR>Here's my 
                              code:<BR><BR><BR><BR><CODE><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Find untouched location with 
                              most information<BR></SPAN><SPAN 
                              class=code-keyword>int</SPAN> xp = <SPAN 
                              class=code-digit>0</SPAN>;<BR><SPAN 
                              class=code-keyword>int</SPAN> yp = <SPAN 
                              class=code-digit>0</SPAN>;<BR><SPAN 
                              class=code-SDKkeyword>byte</SPAN>[] Mp = 
                              null;<BR><SPAN class=code-keyword>int</SPAN> cMp = 
                              <SPAN class=code-digit>10</SPAN>;<BR><BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Try elements<BR></SPAN><SPAN 
                              class=code-keyword>int</SPAN> success = <SPAN 
                              class=code-digit>0</SPAN>;<BR><BR><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> y = <SPAN 
                              class=code-digit>0</SPAN>; y &lt; <SPAN 
                              class=code-digit>9</SPAN>; y++)<BR>{<BR><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> x = <SPAN 
                              class=code-digit>0</SPAN>; x &lt; <SPAN 
                              class=code-digit>9</SPAN>; x++)<BR>{<BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Is this spot 
                              unused?<BR></SPAN><SPAN 
                              class=code-keyword>if</SPAN> (m_sudoku[y, x] == 
                              <SPAN class=code-digit>0</SPAN>)<BR>{<BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Set M of possible 
                              solutions<BR></SPAN><SPAN 
                              class=code-SDKkeyword>byte</SPAN>[] M = { <SPAN 
                              class=code-digit>0</SPAN>, <SPAN 
                              class=code-digit>1</SPAN>, <SPAN 
                              class=code-digit>2</SPAN>, <SPAN 
                              class=code-digit>3</SPAN>, <SPAN 
                              class=code-digit>4</SPAN>, <SPAN 
                              class=code-digit>5</SPAN>, <SPAN 
                              class=code-digit>6</SPAN>, <SPAN 
                              class=code-digit>7</SPAN>, <SPAN 
                              class=code-digit>8</SPAN>, <SPAN 
                              class=code-digit>9</SPAN> };<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Remove used numbers in the 
                              vertical direction<BR></SPAN><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> a = <SPAN 
                              class=code-digit>0</SPAN>; a &lt; <SPAN 
                              class=code-digit>9</SPAN>; a++)<BR>M[m_sudoku[a, 
                              x]] = <SPAN 
                              class=code-digit>0</SPAN>;<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Remove used numbers in the 
                              horizontal direction<BR></SPAN><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> b = <SPAN 
                              class=code-digit>0</SPAN>; b &lt; <SPAN 
                              class=code-digit>9</SPAN>; b++)<BR>M[m_sudoku[y, 
                              b]] = <SPAN 
                              class=code-digit>0</SPAN>;<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Remove used numbers in the sub 
                              square.<BR></SPAN><SPAN 
                              class=code-keyword>int</SPAN> squareIndex = 
                              m_subSquare[y, x];<BR><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> c = <SPAN 
                              class=code-digit>0</SPAN>; c &lt; <SPAN 
                              class=code-digit>9</SPAN>; c++)<BR>{<BR>point p = 
                              m_subIndex[squareIndex, c];<BR>M[m_sudoku[p.x, 
                              p.y]] = <SPAN 
                              class=code-digit>0</SPAN>;<BR>}<BR><BR><SPAN 
                              class=code-keyword>int</SPAN> cM = <SPAN 
                              class=code-digit>0</SPAN>;<BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Calculate cardinality of 
                              M<BR></SPAN><SPAN class=code-keyword>for</SPAN> 
                              (<SPAN class=code-keyword>int</SPAN> d = <SPAN 
                              class=code-digit>1</SPAN>; d &lt; <SPAN 
                              class=code-digit>10</SPAN>; d++)<BR>cM += M[d] == 
                              <SPAN class=code-digit>0</SPAN> ? <SPAN 
                              class=code-digit>0</SPAN> : <SPAN 
                              class=code-digit>1</SPAN>;<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Is there more information in 
                              this spot than in the best yet?<BR></SPAN><SPAN 
                              class=code-keyword>if</SPAN> (cM &lt; 
                              cMp)<BR>{<BR>cMp = cM;<BR>Mp = M;<BR>xp = x;<BR>yp 
                              = y;<BR>}<BR><BR><SPAN 
                              class=code-keyword>for</SPAN> (<SPAN 
                              class=code-keyword>int</SPAN> i = <SPAN 
                              class=code-digit>1</SPAN>; i &lt; <SPAN 
                              class=code-digit>10</SPAN>; i++)<BR>{<BR><SPAN 
                              class=code-keyword>if</SPAN> (Mp[i] != <SPAN 
                              class=code-digit>0</SPAN>)<BR>{<BR>m_sudoku[yp, 
                              xp] = Mp[i];<BR><SPAN class=code-keyword>if</SPAN> 
                              (Solve())<BR>success++;<BR><SPAN 
                              class=code-keyword>else</SPAN> <SPAN 
                              class=code-keyword>break</SPAN>;<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> Restore to original 
                              state.<BR></SPAN>m_sudoku[yp, xp] = <SPAN 
                              class=code-digit>0</SPAN>;<BR><BR><SPAN 
                              class=code-comment>//</SPAN><SPAN 
                              class=code-comment> More than one solution 
                              found?<BR></SPAN><SPAN 
                              class=code-keyword>if</SPAN> (success &gt; <SPAN 
                              class=code-digit>1</SPAN>)<BR><SPAN 
                              class=code-keyword>return</SPAN> <SPAN 
                              class=code-keyword>false</SPAN>;<BR>}<BR>}<BR><BR><BR>}<BR>}<BR>}<BR><BR><SPAN 
                              class=code-keyword>return</SPAN> success == <SPAN 
                              class=code-digit>1</SPAN>;</CODE> <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1883947&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1883947&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1883203">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1883947/Re-Not-unique.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1883947&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1883947 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(2637370,1883947,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F3229343_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=52><A name=xx3229343xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/3229343/Re-Not-unique.aspx" 
                  name=3229343>Re: Not unique</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=4818277">disco</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">17:40 9 Oct 
                  '09 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F3229343_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 52px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=52></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Nope, that didn't work for me. It 
                              generated this puzzle, which according to DLX, is 
                              not 
                              unique.<BR><BR>29.5..7.18143.................9......43.............7.......4.........8..271..3.9<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=3229343&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=3229343&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1883203">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/3229343/Re-Not-unique.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3229343&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF3229343 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(4818277,3229343,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd LoVote Rt HdUnSel " id=F1292670_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx1292670xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1292670/Alternative-solver-generator.aspx" 
                  name=1292670>Alternative solver/generator</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=354175">ohadp</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">4:11 30 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1292670_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2><A 
                              href="http://ohadp.blogspot.com/2005/11/sudoku-solvergenerator-source-code.html" 
                              rel=nofollow>http://ohadp.blogspot.com/2005/11/sudoku-solvergenerator-source-code.html</A> 
                              <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1292670&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1292670&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1292670">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1292670/Alternative-solver-generator.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1292670&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1292670 
                              style="WHITE-SPACE: nowrap">1.33/5 (2 votes)
                              <SCRIPT type=text/javascript>
												MsgVFrm(354175,1292670,false,"","","");
											</SCRIPT>
                               
              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd Rt HdUnSel " id=F1274835_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx1274835xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1274835/Bug-in-TestUniqueness.aspx" 
                  name=1274835>Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=2196104">Simon 
                  Egli</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">5:23 7 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1274835_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hello,<BR><BR>There is a bug in the 
                              routine that tests for uniqueness. Sometimes it 
                              shows that a sudoku is unique if even only one 
                              spot is set.<BR><BR><BR><BR>Greetings<BR><BR>Simon 
                              Egli<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274835&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274835&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1274835/Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1274835&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1274835 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(2196104,1274835,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1274952_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=34><A name=xx1274952xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1274952/Re-Bug-in-TestUniqueness.aspx" 
                  name=1274952>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=634442">Jörgen 
                  Pramberg</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">8:45 7 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1274952_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 34px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=34></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>That definitely sounds like a bug. 
                              Can you give me an example please?<BR>Thanks. 
                            <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274952&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274952&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1274952/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1274952&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1274952 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(634442,1274952,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275015_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=52><A name=xx1275015xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275015/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275015>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">10:08 7 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275015_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 52px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=52></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>I kinda found the same bugs also. 
                              Follow the steps below:<BR><BR>1. Open the 
                              application<BR>2. All cell should be blank now, 
                              assign one cell a number<BR>3. Chk unique (it 
                              should return NOT unique)<BR>4. Clear the 
                              form<BR>5. assign again one cell a number<BR>6. 
                              Chk unique (it now appear to be 
                              unique!!!)<BR><BR>I am looking into it 
                              now.<BR><BR>hhl <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275015&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275015&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275015/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275015&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275015 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1275015,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275262_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=70><A name=xx1275262xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275262/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275262>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=634442">Jörgen 
                  Pramberg</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">14:54 7 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275262_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 70px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=70></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>This bug was introduced when 
                              formatting the code for submission to code 
                              project.<IMG alt="Red faced" 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_redface.gif" 
                              align=top><BR>The last listing should 
                              read:<BR><BR>int success = 0;<BR>for(int i = 1; i 
                              &lt; 10; i++)<BR>{<BR>if(Mp[i] != 
                              0)<BR>{<BR>m_sudoku[yp,xp] = 
                              Mp[i];<BR>if(TestUniqueness())<BR>success++;<BR><BR>// 
                              Restore to original state.<BR>m_sudoku[yp,xp] = 0; 
                              ///** This must be here.<BR><BR>// More than one 
                              solution found?<BR>if(success &gt; 1)<BR>return 
                              false;<BR>}<BR>}<BR><BR>return success == 1; 
                            <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275262&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275262&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275262/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275262&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275262 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(634442,1275262,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275616_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=88><A name=xx1275616xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275616/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275616>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">22:58 7 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275616_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 88px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=88></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Sorry,<BR><BR>I found another sudoku 
                              program that say the below sudoku have more than 1 
                              solution, but your program say that it is 
                              unique:<BR><BR>0 0 0 | 0 0 0 | 0 9 0 <BR>0 0 0 | 0 
                              9 0 | 4 6 7 <BR>9 0 4 | 1 0 0 | 0 2 5 
                              <BR>-------+-------+------ <BR>0 0 9 | 0 0 0 | 0 0 
                              8 <BR>8 7 0 | 0 6 0 | 0 1 4 <BR>6 0 0 | 0 0 0 | 3 
                              0 0 <BR>-------+-------+------ <BR>7 4 0 | 0 0 2 | 
                              9 0 1 <BR>2 9 8 | 0 3 0 | 0 0 0 <BR>0 1 0 | 0 0 0 
                              | 0 0 0 <BR><BR><BR>You can download the sudoku 
                              program at:<BR><A 
                              href="http://www.lemo.dk/sudoku/" 
                              rel=nofollow>http://www.lemo.dk/sudoku/</A>[<A 
                              title="New Window" 
                              href="http://www.lemo.dk/sudoku/" target=_blank 
                              rel=nofollow>^</A>]<BR><BR>and see how to input 
                              sudoku using this program at:<BR><A 
                              href="http://www.lemo.dk/sudoku/faq.html#4" 
                              rel=nofollow>http://www.lemo.dk/sudoku/faq.html#4</A>[<A 
                              title="New Window" 
                              href="http://www.lemo.dk/sudoku/faq.html#4" 
                              target=_blank rel=nofollow>^</A>]<BR><BR>and you 
                              should try to solve the sudoku using the program 
                              at the above link, it will say that it has more 
                              than 1 solution.<BR><BR>I checked that there is 
                              really two solutions for this sudoku, his program 
                              generate the below answer:<BR><BR>5 6 7 | 8 2 4 | 
                              1 9 3 <BR>1 8 2 | 5 9 3 | 4 6 7 <BR>9 3 4 | 1 7 6 
                              | 8 2 5 <BR>-------+-------+------ <BR>4 2 9 | 3 1 
                              7 | 6 5 8 <BR>8 7 3 | 9 6 5 | 2 1 4 <BR>6 5 1 | 2 
                              4 8 | 3 7 9 <BR>-------+-------+------ <BR>7 4 5 | 
                              6 8 2 | 9 3 1 <BR>2 9 8 | 7 3 1 | 5 4 6 <BR>3 1 6 
                              | 4 5 9 | 7 8 2<BR><BR>and your program generate 
                              the following answer:<BR>5 6 7 | 2 8 4 | 1 9 3 
                              <BR>1 8 2 | 5 9 3 | 4 6 7 <BR>9 3 4 | 1 7 6 | 8 2 
                              5 <BR>-------+-------+------ <BR>4 2 9 | 3 1 7 | 6 
                              5 8 <BR>8 7 3 | 9 6 5 | 2 1 4 <BR>6 5 1 | 4 2 8 | 
                              3 7 9 <BR>-------+-------+------ <BR>7 4 6 | 8 5 2 
                              | 9 3 1 <BR>2 9 8 | 7 3 1 | 5 4 6 <BR>3 1 5 | 6 4 
                              9 | 7 8 2<BR><BR>(hope that there is no typo 
                              error, you can generate the answer 
                              yourself)<BR><BR>It is clearly they are different 
                              but filled correctly to the sudoku. So, we see 
                              that there are at least 2 solutions above. So, 
                              your program generate wrong answer for checking 
                              uniqueness.<BR><BR>You'd better check and have a 
                              look. <BR><BR>Thx a lot,<BR>hhl<BR><BR><BR>-- 
                              modified at 23:22 Monday 7th November, 
                          2005<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275616&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275616&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275616/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275616&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275616 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1275616,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275876_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=106><A name=xx1275876xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275876/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275876>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">5:43 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275876_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 106px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=106></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hello,<BR><BR>I kinda solved it 
                              using another way. I find some C code which can 
                              check unique without problem and I call it by 
                              building them into a dll and let C# call 
                              it.<BR><BR>However, another problem arise, since 
                              now the check uniqueness is correct, and when I 
                              click on the generate button, it take an hour to 
                              generate a mask. <BR><BR>And it is reasonable, it 
                              is because it is very very very hard to randomly 
                              generate a mask which is unique.<BR><BR>Therefore, 
                              what would I suggest is to find another way to 
                              solve it: create a base first, then, remove each 
                              cell one by one randomly and check unique on 
                              removing every item.<BR><BR>BTW, the best way is 
                              to have a full source code written in C# for 
                              sudoku.<BR><BR>Hope to hearing from you 
                              soon,<BR>hhl<BR><BR><BR><BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275876&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275876&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275876/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275876&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275876 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1275876,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275917_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=106><A name=xx1275917xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275917/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275917>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=634442">Jörgen 
                  Pramberg</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">6:48 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275917_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 106px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=106></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>If you replace the last couple of 
                              lines in the function TestUniqueness() 
                              with<BR><BR>for(int i = 1; i &lt; 10; 
                              i++)<BR>{<BR>if(Mp[i] != 
                              0)<BR>{<BR>m_sudoku[yp,xp] = 
                              Mp[i];<BR>if(TestUniqueness())<BR>success++;<BR>else<BR>break;<BR><BR>// 
                              More than one solution found?<BR>if(success &gt; 
                              1)<BR>break;<BR>}<BR>}<BR><BR>// Restore to 
                              original state.<BR>m_sudoku[yp,xp] = 
                              0;<BR><BR>return success == 1;<BR>}<BR><BR>it 
                              gives the right result and in a speedy manner as 
                              well. <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275917&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275917&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275917/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275917&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275917 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(634442,1275917,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275961_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=116><A name=xx1275961xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275961/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275961>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">7:58 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275961_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 116px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=116></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Sorry,<BR><BR>I did replace the code 
                              using your code. But it still show "unique" 
                              solution for the masks below:<BR><BR>0 0 0 | 0 0 0 
                              | 0 9 0 <BR>0 0 0 | 0 9 0 | 4 6 7 <BR>9 0 4 | 1 0 
                              0 | 0 2 5 <BR>-------+-------+------ <BR>0 0 9 | 0 
                              0 0 | 0 0 8 <BR>8 7 0 | 0 6 0 | 0 1 4 <BR>6 0 0 | 
                              0 0 0 | 3 0 0 <BR>-------+-------+------ <BR>7 4 0 
                              | 0 0 2 | 9 0 1 <BR>2 9 8 | 0 3 0 | 0 0 0 <BR>0 1 
                              0 | 0 0 0 | 0 0 0 <BR><BR>... What's wrong? Did 
                              you put the above sudoku to the program to check? 
                              It show not unique in your side?<BR><BR>hhl 
                          <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275961&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275961&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275961/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275961&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275961 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1275961,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1275971_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=126><A name=xx1275971xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1275971/Re-Bug-in-TestUniqueness.aspx" 
                  name=1275971>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=634442">Jörgen 
                  Pramberg</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">8:14 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1275971_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 126px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=126></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>It works here. Are you sure that you 
                              built it correctly? Yes, I tried it with your 
                              counter example and it worked out fine. <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275971&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1275971&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1275971/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1275971&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1275971 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(634442,1275971,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1276115_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=136><A name=xx1276115xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1276115/Re-Bug-in-TestUniqueness.aspx" 
                  name=1276115>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">11:29 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1276115_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 136px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=136></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>No, it didn't work here, would you 
                              please send me your application or code to try: 
                              hing.liu@gmail.com<BR><BR>I want to confirm here 
                              that the program will give result of "Unique" in 
                              "Chk Unique" for the sudoku I gave. 
                              <BR><BR>However, it is *NOT* unique actually, 
                              there are multiple solutions. Please verify if you 
                              are testing like this.<BR><BR>Also, since 
                              recursion is hard to trace and I just get the idea 
                              from your code. From my understanding so far, your 
                              idea should be alright. Again ... I really hope 
                              that it is my wrong here ...<BR><BR>hhl <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276115&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276115&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1276115/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1276115&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1276115 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1276115,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1276201_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=146><A name=xx1276201xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1276201/Re-Bug-in-TestUniqueness.aspx" 
                  name=1276201>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=765612">Doncp</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">12:50 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1276201_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 146px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=146></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hi Hing,<BR><BR>I input your map 
                              (and using the revised code shown above, i.e., add 
                              the breaks), and it returned false - i.e., not 
                              unique.<BR><BR>Did you make the changes shown 
                              above?<BR><BR>Don<BR><BR><IMG alt="Poke tongue" 
                              src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/smiley_tongue.gif" 
                              align=top> <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276201&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276201&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1276201/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1276201&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1276201 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(765612,1276201,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1276499_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=156><A name=xx1276499xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1276499/Re-Bug-in-TestUniqueness.aspx" 
                  name=1276499>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">20:34 8 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1276499_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 156px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=156></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>I did make the changes. But it still 
                              show "unique" in the matrix below:<BR><BR>0 0 0 | 
                              0 0 0 | 0 9 0 <BR>0 0 0 | 0 9 0 | 4 6 7 <BR>9 0 4 
                              | 1 0 0 | 0 2 5 <BR>-------+-------+------ <BR>0 0 
                              9 | 0 0 0 | 0 0 8 <BR>8 7 0 | 0 6 0 | 0 1 4 <BR>6 
                              0 0 | 0 0 0 | 3 0 0 <BR>-------+-------+------ 
                              <BR>7 4 0 | 0 0 2 | 9 0 1 <BR>2 9 8 | 0 3 0 | 0 0 
                              0 <BR>0 1 0 | 0 0 0 | 0 0 0 <BR><BR>Would you 
                              please send your code or the executable to me and 
                              try? (my email: hing.liu@gmail.com)<BR><BR>It is 
                              really strange here, it keep saying the above 
                              sudoku unique. <BR><BR>hhl <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276499&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1276499&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1276499/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1276499&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1276499 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1276499,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1792417_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=161><A name=xx1792417xx></A><IMG 
                  height=16 alt=Answer 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_answer.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1792417/Re-Bug-in-TestUniqueness.aspx" 
                  name=1792417>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=880039">jeremyrst</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">11:09 6 Dec 
                  '06 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1792417_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 161px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=161></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>I'm writing a program in C to solve 
                              "Greater than" Suduko problems, and found a fix 
                              for this bug, in that it didn't find non-unique 
                              solutions. One has to allow more than two return 
                              values: no solution, unique solution and 
                              non-unique solutions. The code is:<BR>// Find best 
                              cell, return 1 if finished, 0 if no solution<BR>// 
                              cp points to the best cell<BR>for (success = 0, i 
                              = 1; i &lt;= gamep-&gt;gamesize; i++)<BR>{ newval 
                              = cp-&gt;psbl[i];<BR>if (newval != 0)<BR>{ 
                              push_cell(gamep, cp, newval); // adjusts the 
                              possible values in row/col/subsquare<BR>result = 
                              IsUniqueGame(gamep, cp);<BR>pop_cell(gamep, cp); 
                              // unsets the cell<BR>if (result == 1) /* Solution 
                              found */<BR>success++;<BR>else <BR>if (result &gt; 
                              1) /* Found duplicate, bail out */<BR>return 
                              result;<BR>} /* if */<BR>} /* for */<BR><BR>return 
                              success; <BR>This ensures that the function pops 
                              back to the first call as soon as it finds a 
                              non_unique solution<BR><BR>Best wishes, Jerry 
                            <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1792417&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1792417&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1792417/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1792417&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1792417 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(880039,1792417,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F2956579_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=106><A name=xx2956579xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/2956579/Re-Bug-in-TestUniqueness.aspx" 
                  name=2956579>Re: Bug in TestUniqueness</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=6009472">egenas</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">13:28 9 Mar 
                  '09 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F2956579_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 106px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=106></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>There are nine diferent 
                              Solutions:<BR><BR>567284193182593467934176825429317658873965214651428379746852931298731546315649782 
                              <BR>567824193182593467934176825429317658873965214651248379745682931298731546316459782 
                              <BR>567248193182593467934176825429317658873965214651824379745682931298731546316459782 
                              <BR>567428193182395467934176825459213678873569214621847359745682931298731546316954782 
                              <BR>567428193182593467934176825429317658873965214651284379746852931298731546315649782 
                              <BR>587426193132598467964173825429317658873965214651284379746852931298731546315649782 
                              <BR>587426193132895467964173825429317658873569214651248379745682931298731546316954782 
                              <BR>587246193132598467964173825429317658873965214651824379745682931298731546316459782 
                              <BR>587246193132895467964173825429317658873569214651428379745682931298731546316954782<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=2956579&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=2956579&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1274835">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/2956579/Re-Bug-in-TestUniqueness.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=2956579&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF2956579 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(6009472,2956579,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgRtDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd Rt HdUnSel " id=F1272543_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=16><A name=xx1272543xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1272543/Bugs-or-not.aspx" 
                  name=1272543>Bugs or not?</A> <A title="Click to pin message" 
                  onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">23:44 3 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1272543_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 16px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=16></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hello,<BR><BR>I found in your code, 
                              in the Gen(...) function, it will check whether 
                              there is spot on the board and then generate the 
                              new board without modifying the original spot, 
                              that is:<BR><BR>int num = 
                              GetNumberSpots();<BR><BR>if(!IsSudokuFeasible() || 
                              num &gt; spots)<BR>{<BR>// The supplied data is 
                              not feasible, clear data.<BR>// - or -<BR>// The 
                              supplied data has too many spots set, clear 
                              data.<BR>Clear();<BR>num = 0;<BR>}<BR><BR>However, 
                              I found that, sometime the program will cover the 
                              spot that I already made there. <BR><BR>For 
                              example, if I set (0, 8) to "9", and then generate 
                              a new sudoku, sometime, it will not modify the 
                              "9", however, sometime, it will or even make the 
                              (0, 8) become "-". It is expected the "9" on the 
                              (0, 8) should always keep there. Is that my 
                              understanding is wrong?<BR><BR>I am still looking 
                              into your code, do you have any idea on that? 
                              <BR><BR>Thanks a lot,<BR>hhl<BR><BR><BR>-- 
                              modified at 0:04 Friday 4th November, 
                          2005<BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1272543&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1272543&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1272543">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1272543/Bugs-or-not.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1272543&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1272543 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1272543,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1272774_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=34><A name=xx1272774xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1272774/Re-Bugs-or-not.aspx" 
                  name=1272774>Re: Bugs or not?</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">5:26 4 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1272774_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 34px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=34></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Also, <BR><BR>Sudoki have the 
                              features that it is symmetric. But i can't see 
                              your sudoku program generate a symmetric matrix. 
                              <BR><BR>hhl <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1272774&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1272774&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1272543">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1272774/Re-Bugs-or-not.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1272774&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1272774 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1272774,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd HdUnSel " id=F1274177_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=52><A name=xx1274177xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1274177/Re-Bugs-or-not.aspx" 
                  name=1274177>Re: Bugs or not?</A> <A 
                  title="Click to pin message" onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=201367">Hing</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">7:12 6 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1274177_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 52px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=52></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>I have solved a problem and modifed 
                              your project to support Symmetric. I will post a 
                              new topic about that later. <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274177&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1274177&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1272543">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1274177/Re-Bugs-or-not.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1274177&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1274177 
                              style="WHITE-SPACE: nowrap">
                              <SCRIPT type=text/javascript>
												MsgVFrm(201367,1274177,false,"","","");
											</SCRIPT>
                              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR class=Quick>
          <TD class=Frm_MsgDivide><IMG height=1 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR><!-- Start Message head -->
        <TR class="MsgHd LoVote HdUnSel " id=F1291799_h0>
          <TD width="100%">
            <TABLE class=QuickHd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent width=70><A name=xx1291799xx></A><IMG 
                  height=16 alt=General 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
                  width=16 align=top></TD>
                <TD class=Frm_MsgSubject><A id=DynMessLink 
                  href="http://www.codeproject.com/Messages/1291799/Re-Symmetric.aspx" 
                  name=1291799>Re: Symmetric</A> <A title="Click to pin message" 
                  onclick="return Pin(this);" 
                  href="http://www.codeproject.com/KB/game/sudoku.aspx#"><IMG 
                  height=12 alt=Pin 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/pin.gif" 
                  width=13 align=top border=0></A></TD>
                <TD style="WIDTH: 20px; WHITE-SPACE: nowrap"><IMG title=member 
                  height=16 alt=member 
                  src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/member_sm.gif" 
                  border=0></TD>
                <TD class=Frm_MsgAuthor><A 
                  href="http://www.codeproject.com/script/Membership/View.aspx?mid=2485499">SrMerlini</A></TD>
                <TD class=Frm_MsgDate 
                style="VERTICAL-ALIGN: top; WHITE-SPACE: nowrap">7:13 29 Nov 
                  '05 &nbsp;</TD></TR></TBODY></TABLE></TD></TR><!-- End Message head -->
        <TR id=F1291799_h1 style="DISPLAY: none">
          <TD width="100%">
            <TABLE class=QuickBd cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD class=Frm_MsgIndent style="WIDTH: 70px"><IMG height=1 
                  alt="" 
                  src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
                  width=70></TD>
                <TD class="MsgBd BdSel ">
                  <TABLE cellSpacing=5 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD colSpan=2>Hello Hing,<BR><BR>Could you explain 
                              us what you modified to support 
                              Symmetric?<BR><BR>Thanks in advance! <BR></TD></TR>
                          <TR style="VERTICAL-ALIGN: middle">
                            <TD class=Frm_MsgFt><A class=Frm_MHL title=Reply 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1291799&amp;floc=/KB/game/sudoku.aspx&amp;action=r">Reply</A>·<A 
                              class=Frm_MHL title=Email 
                              href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=225854&amp;select=1291799&amp;floc=/KB/game/sudoku.aspx&amp;action=e">Email</A>·<A 
                              class=Frm_MHL title=View&nbsp;Thread 
                              href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;tid=1272543">View&nbsp;Thread</A>·<A 
                              class=Frm_MHL title="Get permanent link" 
                              href="http://www.codeproject.com/Messages/1291799/Re-Symmetric.aspx">PermaLink</A>·<A 
                              class=Frm_MHL title="Bookmark this post" 
                              href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1291799&amp;obtid=3&amp;action=AddBookmark">Bookmark</A></TD>
                            <TD class=Frm_MsgFt 
                              style="TEXT-ALIGN: right"><SPAN id=MVF1291799 
                              style="WHITE-SPACE: nowrap">2.00/5 (1 vote)
                              <SCRIPT type=text/javascript>
												MsgVFrm(2485499,1291799,false,"","","");
											</SCRIPT>
                               
              </SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD><IMG height=5 alt="" 
            src="G:\l论文资料\sudoku开发参考资料\遗传算法\CodeProject Sudoku Solver and Generator_ Free source code and programming help.files\t(1).gif" 
            width=1 border=0></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=2 width="100%">
        <TBODY>
        <TR class=Frm_Footer>
          <TD>Last Visit: 0:01 13 Nov '09 &nbsp; &nbsp; Last Update: 5:55 15 
            Nov '09 </TD>
          <TD style="WHITE-SPACE: nowrap; TEXT-ALIGN: right"><INPUT id=_mbnUrl 
            type=hidden 
            value=/KB/game/sudoku.aspx?fid=225854&amp;fr=26><B>1</B><A 
            class=Frm_HL 
            href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;fr=26#xx0xx" 
            name=Frm_HoverNL>2</A> <A class=Frm_HL 
            href="http://www.codeproject.com/KB/game/sudoku.aspx?fid=225854&amp;fr=26#xx0xx" 
            name=Frm_HoverNL>Next 
»</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
<P class=SmallText><IMG height=16 alt=General 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_general.gif" 
width=16 align=top> General &nbsp;&nbsp; <IMG height=16 alt=News 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_news.gif" 
width=16 align=top> News &nbsp;&nbsp; <IMG height=16 alt=Question 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_question.gif" 
width=16 align=top> Question &nbsp;&nbsp; <IMG height=16 alt=Answer 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_answer.gif" 
width=16 align=top> Answer &nbsp;&nbsp; <IMG height=16 alt=Joke 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_joke.gif" 
width=16 align=top> Joke &nbsp;&nbsp; <IMG height=16 alt=Rant 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_rant.gif" 
width=16 align=top> Rant &nbsp;&nbsp; <IMG height=16 alt=Admin 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/msg_admin.gif" 
width=16 align=top> Admin &nbsp;&nbsp; </P><!-- Forum End --></DIV>
<TABLE width="100%">
  <TBODY>
  <TR vAlign=top>
    <TD class=TinyText align=left><A id=ctl00_PermaLink 
      href="http://www.codeproject.com/script/Articles/Article.aspx?aid=11983">PermaLink</A> 
      | <A id=ctl00_PrivacyLink 
      href="http://www.codeproject.com/info/privacy.aspx">Privacy</A> | <A 
      id=ctl00_TermsOfUseLink 
      href="http://www.codeproject.com/info/TermsOfUse.aspx">Terms of Use</A> 
      <BR>Last Updated: 8 Nov 2005<BR>Editor: <A id=ctl00_ArticleEditor 
      href="http://www.codeproject.com/script/Membership/View.aspx?mid=28970">Smitha 
      Vijayan</A><BR></TD>
    <TD class=TinyText vAlign=top align=right>Copyright 2005 by Jrgen 
      Pramberg<BR>Everything else Copyright © <A 
      href="mailto:webmaster@codeproject.com">CodeProject</A>, 1999-2009 
      <BR>Web21 | <A id=ctl00_AdvertiseLink 
      href="http://www.codeproject.com/info/MediaKit.aspx">Advertise on the Code 
      Project </A></TD></TR></TBODY></TABLE>
<CENTER></CENTER></DIV></DIV>
<DIV></DIV><BR>
<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/oncopy.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/TogglePre.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/JobsSummaryRetriever.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/addto.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/bookmark.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript 
src="CodeProject Sudoku Solver and Generator_ Free source code and programming help.files/rateitem.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=Javascript type=text/javascript>//<![CDATA[
if (document.all) try {window.attachEvent("oncopy",copyCode);}catch(e){};
var e=document;
if(e){if(document.all)try{e.attachEvent('onkeydown',LK);}catch(ex){} 
else e.addEventListener('keydown',LK, false);}

var e=document;
if(e){if(document.all)try{e.attachEvent('onkeyup',LK);}catch(ex){} 
else e.addEventListener('keyup',LK, false);}

var e=document;
if(e){if(document.all)try{e.attachEvent('onblur',LK);}catch(ex){} 
else e.addEventListener('blur',LK, false);}

var e=document.getElementById('ctl00_TopNavBar_Lounge');
if(e){if(document.all)try{e.attachEvent('onclick',LC);}catch(ex){} 
else e.addEventListener('click',LC, false);}

var e=document.getElementById('ctl00_TopNavBar_Soapbox');
if(e){if(document.all)try{e.attachEvent('onclick',LC);}catch(ex){} 
else e.addEventListener('click',LC, false);}

var elms = document.getElementById("nav");var uls = elms.getElementsByTagName("ul");for(var i=0;i<uls.length;i++) {var lis = uls[i].getElementsByTagName("li");for(var j=0;j<lis.length;j++) {lis[j].style.cursor='pointer';lis[j].onclick=function(){location.href=this.firstChild.href;}}}
$(document).ready(function() {RetrieveJobsSummary('Th',11983,2,48,"7,11,38,81,94,118,153");});
var socialLinks = new social();
socialLinks.PlaceholderId="ATD";socialLinks.ObjectId=11983;
socialLinks.ObjectTypeId=2;
socialLinks.addtoMethod=1;
socialLinks.Horizontal=false;
socialLinks.Showname=true;
socialLinks.setupLinks("socialLinks", document.location.href,escape(document.title), 100, 0, "SmallText Bold", "AddTo");
socialLinks.setupMenu();
$('#ctl00_RateArticle_RateItemWrapper').css('display', '');

//]]></SCRIPT>
</BODY></HTML>
